threads / discuss / 23922

git pull works remotely but not locally

Subject: git pull works remotely but not locally

## tl;dr

17 messages between May 27, 2010 and May 28, 2010.

replies: 16people: 6as markdown or json

Ivan Uemlianin· May 27, 2010, 13:35 UTC · lore
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://username@12.34.56.78/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 denied
fetch 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
-- 
============================================================
Ivan A. Uemlianin
Speech Technology Research and Development

                     ivan@llaisdy.com
                      www.llaisdy.com
                          llaisdy.wordpress.com
                      www.linkedin.com/in/ivanuemlianin

     "Froh, froh! Wie seine Sonnen, seine Sonnen fliegen"
                      (Schiller, Beethoven)
============================================================
Ramkumar Ramachandra· May 27, 2010, 14:20 UTC · re: Ivan Uemlianin · lore

Re: git pull works remotely but not locally

Hi,
>        $ 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
Ivan Uemlianin· May 27, 2010, 14:37 UTC · re: Ramkumar Ramachandra · lore

Re: git pull works remotely but not locally

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
On 27/05/2010 15:20, Ramkumar Ramachandra wrote:
Show 12 quoted lines
> Hi,
>
>    
>>         $ 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
>    
-- 
============================================================
Ivan A. Uemlianin
Speech Technology Research and Development

                     ivan@llaisdy.com
                      www.llaisdy.com
                          llaisdy.wordpress.com
                      www.linkedin.com/in/ivanuemlianin

     "Froh, froh! Wie seine Sonnen, seine Sonnen fliegen"
                      (Schiller, Beethoven)
============================================================
Sverre Rabbelier· May 27, 2010, 14:47 UTC · re: Ivan Uemlianin · lore

Re: git pull works remotely but not locally

Heya,
On Thu, May 27, 2010 at 16:37, Ivan Uemlianin <ivan@llaisdy.com> wrote:
> 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.

-- 
Cheers,

Sverre Rabbelier
Ivan Uemlianin· May 27, 2010, 15:07 UTC · re: Sverre Rabbelier · lore

Re: git pull works remotely but not locally

Dear All
Thanks for your comments.
On Thu, May 27, 2010 at 4:37 PM, Ivan Uemlianin<ivan@llaisdy.com>  wrote:
> >  git-pull is 755, and I can run /path/to/git-pull (I get an error and it
> >  crashes, but I have the permission).
>    
On 27/05/2010 15:47, Sverre Rabbelier wrote:
Show 5 quoted lines
> ...
> 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.
>    
On 27/05/2010 15:50, Ramkumar Ramachandra wrote:
Show 8 quoted lines
> ...
> 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 directory

I'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
-- 
============================================================
Ivan A. Uemlianin
Speech Technology Research and Development

                     ivan@llaisdy.com
                      www.llaisdy.com
                          llaisdy.wordpress.com
                      www.linkedin.com/in/ivanuemlianin

     "Froh, froh! Wie seine Sonnen, seine Sonnen fliegen"
                      (Schiller, Beethoven)
============================================================
Jeff King· May 27, 2010, 15:15 UTC · re: Ivan Uemlianin · lore

Re: git pull works remotely but not locally

On Thu, May 27, 2010 at 04:07:05PM +0100, Ivan Uemlianin wrote:
Show 11 quoted 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 directory
> 
> I'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
Ivan Uemlianin· May 27, 2010, 15:21 UTC · re: Jeff King · lore

Re: git pull works remotely but not locally

Dear Peff
Thanks for your comment.
> 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
On 27/05/2010 16:15, Jeff King wrote:
Show 25 quoted lines
> On Thu, May 27, 2010 at 04:07:05PM +0100, Ivan Uemlianin wrote:
>
>    
>>> 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 directory
>>
>> I'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
>    
-- 
============================================================
Ivan A. Uemlianin
Speech Technology Research and Development

                     ivan@llaisdy.com
                      www.llaisdy.com
                          llaisdy.wordpress.com
                      www.linkedin.com/in/ivanuemlianin

     "Froh, froh! Wie seine Sonnen, seine Sonnen fliegen"
                      (Schiller, Beethoven)
============================================================
Johannes Sixt· May 27, 2010, 15:28 UTC · re: Ivan Uemlianin · lore

Re: git pull works remotely but not locally

Please Reply-To-All, do not cull Cc list.
Am 5/27/2010 17:21, schrieb Ivan Uemlianin:
> $ 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
Ivan Uemlianin· May 27, 2010, 15:37 UTC · re: Johannes Sixt · lore

Re: git pull works remotely but not locally

Yes, that would be odd.  I can run /bin/sh :)
On 27/05/2010 16:28, Johannes Sixt wrote:
Show 14 quoted lines
> Please Reply-To-All, do not cull Cc list.
>
> Am 5/27/2010 17:21, schrieb Ivan Uemlianin:
>    
>> $ 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
>    
-- 
============================================================
Ivan A. Uemlianin
Speech Technology Research and Development

                     ivan@llaisdy.com
                      www.llaisdy.com
                          llaisdy.wordpress.com
                      www.linkedin.com/in/ivanuemlianin

     "Froh, froh! Wie seine Sonnen, seine Sonnen fliegen"
                      (Schiller, Beethoven)
============================================================
Jeff King· May 27, 2010, 15:38 UTC · re: Ivan Uemlianin · lore

Re: git pull works remotely but not locally

On Thu, May 27, 2010 at 04:21:28PM +0100, Ivan Uemlianin wrote:
Show 11 quoted lines
> Thanks for your comment.
> >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
Ivan Uemlianin· May 27, 2010, 16:21 UTC · re: Jeff King · lore

Re: git pull works remotely but not locally

On 27/05/2010 16:38, Jeff King wrote:
> 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).

Show 9 quoted 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 directory
Those 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
-- 
============================================================
Ivan A. Uemlianin
Speech Technology Research and Development

                     ivan@llaisdy.com
                      www.llaisdy.com
                          llaisdy.wordpress.com
                      www.linkedin.com/in/ivanuemlianin

     "Froh, froh! Wie seine Sonnen, seine Sonnen fliegen"
                      (Schiller, Beethoven)
============================================================
Ilari Liusvaara· May 27, 2010, 16:57 UTC · re: Ivan Uemlianin · lore

Re: git pull works remotely but not locally

On Thu, May 27, 2010 at 05:21:50PM +0100, Ivan Uemlianin wrote:
Show 19 quoted lines
> On 27/05/2010 16:38, Jeff King wrote:
> >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).
> >   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.
 
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
Ramkumar Ramachandra· May 27, 2010, 15:15 UTC · re: Ivan Uemlianin · lore

Re: git pull works remotely but not locally

Hi,
>    /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.

> 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
Ivan Uemlianin· May 27, 2010, 15:36 UTC · re: Ramkumar Ramachandra · lore

Re: git pull works remotely but not locally

On 27/05/2010 16:15, Ramkumar Ramachandra wrote:
Show 10 quoted lines
> Hi,
>
>    
>>     /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.
>    
... but git-sh-setup is in /opt/libexec/git-core/ ...
Show 7 quoted 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`.
>    
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
-- 
============================================================
Ivan A. Uemlianin
Speech Technology Research and Development

                     ivan@llaisdy.com
                      www.llaisdy.com
                          llaisdy.wordpress.com
                      www.linkedin.com/in/ivanuemlianin

     "Froh, froh! Wie seine Sonnen, seine Sonnen fliegen"
                      (Schiller, Beethoven)
============================================================
Johannes Sixt· May 27, 2010, 19:53 UTC · re: Ivan Uemlianin · lore

Re: git pull works remotely but not locally

On Donnerstag, 27. Mai 2010, Ivan Uemlianin wrote:
> - 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
Ivan Uemlianin· May 28, 2010, 08:24 UTC · re: Johannes Sixt · lore

Re: git pull works remotely but not locally

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
On 27/05/2010 20:53, Johannes Sixt wrote:
Show 29 quoted lines
> On Donnerstag, 27. Mai 2010, Ivan Uemlianin wrote:
>    
>> - 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
>    
-- 
============================================================
Ivan A. Uemlianin
Speech Technology Research and Development

                     ivan@llaisdy.com
                      www.llaisdy.com
                          llaisdy.wordpress.com
                      www.linkedin.com/in/ivanuemlianin

     "Froh, froh! Wie seine Sonnen, seine Sonnen fliegen"
                      (Schiller, Beethoven)
============================================================
Ramkumar Ramachandra· May 27, 2010, 14:50 UTC · re: Ivan Uemlianin · lore

Re: git pull works remotely but not locally

Hi,
On Thu, May 27, 2010 at 4:37 PM, Ivan Uemlianin <ivan@llaisdy.com> wrote:
> 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

← back to recent threads