On Tue, Oct 30, 2012 at 12:55:52PM -0700, Philipp Kraus wrote:
> > My gut feeling is that Git is not wrong here. Try the following:
> > Do a sudo su webserver ("become" the webserver user), and do the exact
> > commands it (or PHP) is trying to do in the exact same directories.
> > If you don't get the same error message, you better share your PHP script
> > so we can scan it for any obvious problems.
> I have run the command with sudo and it creates the same error.
> I run this command: '/usr/bin/git'
> '--git-dir=/tmp/gitzip_1b1f12ff79322b9e6515e3aeff3390b4/.git' 'pull' '-f'
> I think this is incorrect. I would like to get all changes into the repo
> from the orgigin. Can anybody explain which is the correct call?
It's not clear what do you really want to do from this description,
and anyway pulling changes from the remote has nothng to do with the
error mentioned in your original post.
But anyway, assuming the repository in that temporary directory has a
remote named "origin" configured in it, the command "to bring all
changes ... from the «origin»" would be:
$ git --git-dir=... fetch origin
This command would update (or create) the so-called "remote branches"
for that "origin" repository in your local repository.
It is then up to you to update whatever local branches in your
repository by the data contained in those just updated remote branches.
Usually this means merging or rebasing for the branches of interest.
(Note that `git pull` combines `git fetch` with `git merge`.)
But like Thomas in his reply, I, too, have a gut feeling it's not really
what you want (since you clearly employ scripting and deal with a
repository which looks like a scratch place, and all this hints you're
doing deployment or something other automated task). So I'll do a wild
guess and assume you really want to make your local repository to look
*exactly* like "origin". If so, the proper way to do that would be
$ git --git-dir=... fetch origin +refs/*:refs/*
(or +refs/heads/*:refs/heads/* for the last argument if you want only
branches and no tags, notes etc). This command would just force-update
or create all the branches and tags the remote "origin" has in your
local repository (so that your local "master" is identical to the
origin's "master" and so on for every other branch "origin" has).
Note that that last argument to `git fetch` (called "the refspec")
allows for very flexible operation: using asterisks obviously means
"all available" but you can use specific branch (or tag or whatnot)
names, and specify several refspecs at once. For instance,
$ git ... fetch origin +refs/heads/master:refs/heads/foo \
would use the origin's branch "master" to force-update your local branch
"foo" and origin's branch "devel" to update the local branch "bar"
(failing the operation if "devel" does not contain "bar" so the latter
cannot be fast-forwarded by the update).
Keeping this in mind (and reading the `git fetch` manual carefully) you
can set up whatever updating scenariou your situation requires.