git pull works remotely but not locally
Dear All
I have just set up my first git repository, and I'm trying things out before using it for real. To start with I'm using a centralised workflow with the main repos on a server, and workers checking work out and in. I'm using the smart http backend. I can contact the repos remotely via http or locally using the filesystem. However, git pull is not working in the local case. Please can someone offer help with (a) file permissions, and (b) difference between git pull, and git fetch; git merge (which works):
The basics seem to be working OK remotely: ie contacting the server over http:
git clone http://[email protected]/git/projectname.git
What I mean is push and pull are working.
When working on the server itself I'm using
git clone /var/www/git/projectname.git
Most things seem to work the same, but git pull does not work:
$ git pull
fatal: cannot exec 'git-pull': Permission deniedfetch followed by merge seems to have the desired effect, e.g.:
$ git fetch
remote: Counting objects: 5, done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 1), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
From /var/www/git/projectname
6b40c1f..4ffb389 master -> origin/master $ git merge origin
Updating 6b40c1f..4ffb389
Fast-forward
notes.txt | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)So, my questions are:
(a) Why isn't git pull working in the second case? What permissions am I missing?
(b) Does git fetch; git merge origin do the same thing as git pull?
With thanks and best wishes
Ivan
Signature · 12 lines
============================================================
Ivan A. Uemlianin
Speech Technology Research and Development
[email protected]
www.llaisdy.com
llaisdy.wordpress.com
www.linkedin.com/in/ivanuemlianin
"Froh, froh! Wie seine Sonnen, seine Sonnen fliegen"
(Schiller, Beethoven)
============================================================Hi,
Quoted 2 lines
$ git pull fatal: cannot exec 'git-pull': Permission denied
git-pull is simply a shell script (see git-pull.sh in git.git) which executes git fetch and git merge-base among other things. Maybe your git-pull file doesn't have execute permissions?
-- Ram
Dear Ram
Thank you for your comment.
git-pull is 755, and I can run /path/to/git-pull (I get an error and it crashes, but I have the permission).
Ivan
Quoted 12 lines · Ramkumar Ramachandra
Hi,
Quoted 3 lines
$ git pull fatal: cannot exec 'git-pull': Permission deniedgit-pull is simply a shell script (see
git-pull.shin git.git) which executesgit fetchandgit merge-baseamong other things. Maybe your git-pull file doesn't have execute permissions?-- Ram
Signature · 12 lines
============================================================
Ivan A. Uemlianin
Speech Technology Research and Development
[email protected]
www.llaisdy.com
llaisdy.wordpress.com
www.linkedin.com/in/ivanuemlianin
"Froh, froh! Wie seine Sonnen, seine Sonnen fliegen"
(Schiller, Beethoven)
============================================================Hi,
Quoted 2 lines · Ivan Uemlianin
git-pull is 755, and I can run /path/to/git-pull (I get an error and it crashes, but I have the permission).
Your error comes from run-command.c:290 - Maybe it tries to execute git-pull and (wrongly) reports that it wasn't able to execute it? What error (and return status) do you get when you execute the script yourself?
It looks like there's something wrong with your installation of Git. Perhaps you'd like to re-install?
-- Ram
Heya,
Quoted 2 lines · Ivan Uemlianin
git-pull is 755, and I can run /path/to/git-pull (I get an error and it crashes, but I have the permission).
That's not supposed to happen, what does it say? Also, is it possible you have an old git install lying around? It might be that it's partly using the old, and partly using the new install.
Signature · 3 lines
Cheers, Sverre Rabbelier
Dear All
Thanks for your comments.
Quoted 3 lines · Ivan Uemlianin
Quoted 2 lines
git-pull is 755, and I can run /path/to/git-pull (I get an error and it crashes, but I have the permission).
Quoted 5 lines · Sverre Rabbelier
...
That's not supposed to happen, what does it say? Also, is it possible you have an old git install lying around? It might be that it's partly using the old, and partly using the new install.
Quoted 8 lines · Ramkumar Ramachandra
...
Your error comes from run-command.c:290 - Maybe it tries to execute git-pull and (wrongly) reports that it wasn't able to execute it? What error (and return status) do you get when you execute the script yourself?
It looks like there's something wrong with your installation of Git. Perhaps you'd like to re-install
The error is like this:
$ /opt/libexec/git-core/git-pull
/opt/libexec/git-core/git-pull: line 11: git-sh-setup: No such file
or directoryI'm calling git-pull from my clone of the repos, so I don't have git-sh-setup in my current directory. That all seems fine: I imagine git-pull is not intended to be called directly.
The git is a recent install from source, on a Centos machine. There was no git previous.
As for reinstalling: unless something else is broken, I'm happy with "git fetch; git merge origin". However, I should like to understand why git pull is not working.
Best wishes
Ivan
Signature · 12 lines
============================================================
Ivan A. Uemlianin
Speech Technology Research and Development
[email protected]
www.llaisdy.com
llaisdy.wordpress.com
www.linkedin.com/in/ivanuemlianin
"Froh, froh! Wie seine Sonnen, seine Sonnen fliegen"
(Schiller, Beethoven)
============================================================Quoted 11 lines · Ivan Uemlianin
Quoted 2 lines
It looks like there's something wrong with your installation of Git. Perhaps you'd like to re-install
The error is like this:
$ /opt/libexec/git-core/git-pull /opt/libexec/git-core/git-pull: line 11: git-sh-setup: No such file or directoryI'm calling git-pull from my clone of the repos, so I don't have git-sh-setup in my current directory. That all seems fine: I imagine git-pull is not intended to be called directly.
It's not. It expects the git wrapper to have set up the PATH to have /opt/libexec/git-core in it, which would then find git-sh-setup.
What happens if you run "git pull"? If you get an error, can you try to run "GIT_TRACE=1 git pull"? Git should then print out exactly what it is trying to exec that is failing.
-Peff
Dear Peff
Thanks for your comment.
Quoted 3 lines
What happens if you run "git pull"? If you get an error, can you try to run "GIT_TRACE=1 git pull"? Git should then print out exactly what it is trying to exec that is failing.
Not very exciting:
$ GIT_TRACE=1 git pull trace: exec: 'git-pull' trace: run_command: 'git-pull' fatal: cannot exec 'git-pull': Permission denied
Best wishes
Ivan
Quoted 25 lines · Jeff King
Quoted 5 lines · Ivan Uemlianin
Quoted 3 lines
It looks like there's something wrong with your installation of Git. Perhaps you'd like to re-install
The error is like this:
Quoted 8 lines
$ /opt/libexec/git-core/git-pull /opt/libexec/git-core/git-pull: line 11: git-sh-setup: No such file or directoryI'm calling git-pull from my clone of the repos, so I don't have git-sh-setup in my current directory. That all seems fine: I imagine git-pull is not intended to be called directly.
It's not. It expects the git wrapper to have set up the PATH to have
/opt/libexec/git-corein it, which would then find git-sh-setup.What happens if you run "git pull"? If you get an error, can you try to run "GIT_TRACE=1 git pull"? Git should then print out exactly what it is trying to exec that is failing.
-Peff
Signature · 12 lines
============================================================
Ivan A. Uemlianin
Speech Technology Research and Development
[email protected]
www.llaisdy.com
llaisdy.wordpress.com
www.linkedin.com/in/ivanuemlianin
"Froh, froh! Wie seine Sonnen, seine Sonnen fliegen"
(Schiller, Beethoven)
============================================================Quoted 11 lines · Ivan Uemlianin
Thanks for your comment.
Quoted 3 lines
What happens if you run "git pull"? If you get an error, can you try to run "GIT_TRACE=1 git pull"? Git should then print out exactly what it is trying to exec that is failing.
Not very exciting:
$ GIT_TRACE=1 git pull trace: exec: 'git-pull' trace: run_command: 'git-pull' fatal: cannot exec 'git-pull': Permission denied
Then the next thing to try is probably (assuming you are running Linux):
strace -f -e execve git pull
Though I suspect we may just see:
execve("/opt/libexec/git-core/git-core/git-pull", ...) = -1 EACCES (Permission denied)
which doesn't help much. I just want to be sure that is the source of the problem.
-Peff
Quoted 2 lines · Jeff King
Then the next thing to try is probably (assuming you are running Linux):
Well, kind of: it's CentOS, which I'm finding quite recalcitrant (e.g. I had to install strace).
Quoted 9 lines
strace -f -e execve git pull
Though I suspect we may just see:
execve("/opt/libexec/git-core/git-core/git-pull", ...)= -1 EACCES (Permission denied)which doesn't help much. I just want to be sure that is the source of the problem.
No, the output is interesting. The permissions denied is from the erroneous /root install (see separate email):
[pid 3485] execve("/root/libexec/git-core/git-pull", ["git-pull"], [/* 18 vars */]) = -1 EACCES (Permission denied)
It looks in /opt/bin, but not /opt/libexec.
It could be a botched git install or it could be a botched PATH --- I have had to fiddle about with it a bit. For example, /opt/libexec is not on my PATH ... In fact my PATH *is* botched:
$ $PATH
bash: /opt/bin:<snip/>:/usr/bin:/root/bin: No such file or directoryThose last two items don't look good at all. And:
$ PATH=/opt/libexec/git-core/:$PATH
$ git pull
remote: Counting objects: 8, done.
...
1 files changed, 2 insertions(+), 1 deletions(-)Working!
So:
- git itself is probably OK
- I have a botched PATH, which I should fix asap
Does git expect certain paths to be on a user's PATH? If so perhaps that is all that is wrong.
Best wishes
Ivan
Signature · 12 lines
============================================================
Ivan A. Uemlianin
Speech Technology Research and Development
[email protected]
www.llaisdy.com
llaisdy.wordpress.com
www.linkedin.com/in/ivanuemlianin
"Froh, froh! Wie seine Sonnen, seine Sonnen fliegen"
(Schiller, Beethoven)
============================================================Quoted 12 lines · Ivan Uemlianin
Quoted 1 line · Jeff King
Then the next thing to try is probably (assuming you are running Linux):
Well, kind of: it's CentOS, which I'm finding quite recalcitrant (e.g. I had to install strace).
Quoted 8 lines
strace -f -e execve git pull
Though I suspect we may just see:
execve("/opt/libexec/git-core/git-core/git-pull", ...)= -1 EACCES (Permission denied)which doesn't help much. I just want to be sure that is the source of the problem.
Quoted 7 lines
No, the output is interesting. The permissions denied is from the erroneous /root install (see separate email):
[pid 3485] execve("/root/libexec/git-core/git-pull",["git-pull"], [/* 18 vars */]) = -1 EACCES (Permission denied)
It looks in
/opt/bin, but not/opt/libexec.
That looks like you are either running wrong git binary (one in /root/bin?) or the git installation is busted.
No, the git libexec directory SHOULD NOT be in PATH (git will add it there when needed).
-Ilari
Please Reply-To-All, do not cull Cc list.
Am 5/27/2010 17:21, schrieb Ivan Uemlianin:
Quoted 4 lines
$ GIT_TRACE=1 git pull trace: exec: 'git-pull' trace: run_command: 'git-pull' fatal: cannot exec 'git-pull': Permission denied
You get 'Permission denied' also if you cannot execute the shell that the first line of the script references. But that would be really odd...
-- Hannes
Yes, that would be odd. I can run /bin/sh :)
Quoted 14 lines · Johannes Sixt
Please Reply-To-All, do not cull Cc list.
Am 5/27/2010 17:21, schrieb Ivan Uemlianin:
Quoted 5 lines
$ GIT_TRACE=1 git pull trace: exec: 'git-pull' trace: run_command: 'git-pull' fatal: cannot exec 'git-pull': Permission deniedYou get 'Permission denied' also if you cannot execute the shell that the first line of the script references. But that would be really odd...
-- Hannes
Signature · 12 lines
============================================================
Ivan A. Uemlianin
Speech Technology Research and Development
[email protected]
www.llaisdy.com
llaisdy.wordpress.com
www.linkedin.com/in/ivanuemlianin
"Froh, froh! Wie seine Sonnen, seine Sonnen fliegen"
(Schiller, Beethoven)
============================================================Hi,
Quoted 2 lines
/opt/libexec/git-core/git-pull: line 11: git-sh-setup: No such file or directory
You seem to be missing git-sh-setup (called git-sh-setup.sh in git.git), another shell script that's called by every other shell script in Git.
Quoted 3 lines
As for reinstalling: unless something else is broken, I'm happy with "git fetch; git merge origin". However, I should like to understand why git pull is not working.
A lot of other things won't work. git rebase -i for example is another shell script git-rebase--interactive.sh.
-- Ram
Quoted 10 lines · Ramkumar Ramachandra
Hi,
Quoted 3 lines
/opt/libexec/git-core/git-pull: line 11: git-sh-setup: No such file or
directoryYou seem to be missing git-sh-setup (called
git-sh-setup.shin git.git), another shell script that's called by every other shell script in Git.
... but git-sh-setup is in /opt/libexec/git-core/ ...
Quoted 7 lines
Quoted 4 lines
As for reinstalling: unless something else is broken, I'm happy with "git fetch; git merge origin". However, I should like to understand why git pull is not working.
A lot of other things won't work.
git rebase -ifor example is another shell scriptgit-rebase--interactive.sh.
You're right!
Is there something I need to set in my global .gitconfig?
If it's a botched install I need to know why, or it will just be botched the same way when I reinstall. I only remember two things about the install, ...
- I did configure with prefix=/opt
- odd thing: nothing was installed into /opt: it all went into /root (I might have been root for the whole process, which I know is bad). I just cp'd everything over to /opt, and everything worked OK (until now).
Any ideas? I'm happy to reinstall once I know what went wrong. The git I installed on my mac is really working fine.
Best wishes
Ivan
Signature · 12 lines
============================================================
Ivan A. Uemlianin
Speech Technology Research and Development
[email protected]
www.llaisdy.com
llaisdy.wordpress.com
www.linkedin.com/in/ivanuemlianin
"Froh, froh! Wie seine Sonnen, seine Sonnen fliegen"
(Schiller, Beethoven)
============================================================Quoted 4 lines · Ivan Uemlianin
- I did configure with prefix=/opt
- odd thing: nothing was installed into /opt: it all went into /root (I might have been root for the whole process, which I know is bad). I just cp'd everything over to /opt, and everything worked OK (until now).
My guess is:
- You built as root.
- I don't know what went wrong with the command that involved prefix=/opt.
- But when you finally build using 'make', it picked the default prefix, which is /root when you are root.
- This hard-codes the libexec path to /root/libexec/git-core.
- Even after you copy the stuff to /opt, git looks in /root/libexec/...
- As a normal user you do not have access to /root, ergo, Permission denied.
Rebuild as normal user with
make prefix=/opt
and install as root with
make prefix=/opt install
(Yes, prefix must be given also for 'make install'.)
-- Hannes
Dear Hannes
Yes, you have pinpointed it. I installed as root, but I thought I had followed the other instructions (using ./configure) and did
# make configure # ./configure --prefix=/opt # make # make install
In any case, I have deleted everything and reinstalled properly. Now git pull is working as it should.
Thank you all for your patience and help.
Best wishes
Ivan
Quoted 29 lines · Johannes Sixt
Quoted 5 lines · Ivan Uemlianin
- I did configure with prefix=/opt
- odd thing: nothing was installed into /opt: it all went into /root (I might have been root for the whole process, which I know is bad). I just cp'd everything over to /opt, and everything worked OK (until now).My guess is:
- You built as root.
- I don't know what went wrong with the command that involved prefix=/opt.
- But when you finally build using 'make', it picked the default prefix, which is /root when you are root.
- This hard-codes the libexec path to/root/libexec/git-core.
- Even after you copy the stuff to /opt, git looks in/root/libexec/...
- As a normal user you do not have access to /root, ergo, Permission denied.Rebuild as normal user with
make prefix=/opt
and install as root with
make prefix=/opt install
(Yes, prefix must be given also for 'make install'.)
-- Hannes
Signature · 12 lines
============================================================
Ivan A. Uemlianin
Speech Technology Research and Development
[email protected]
www.llaisdy.com
llaisdy.wordpress.com
www.linkedin.com/in/ivanuemlianin
"Froh, froh! Wie seine Sonnen, seine Sonnen fliegen"
(Schiller, Beethoven)
============================================================