Search code examples
eclipsegitegitgit-push

Unable to push using Eclipse/Egit to repository over SSH with git-receive-pack and git-upload-pack set


The title pretty much says it all:

I'm using Eclipse (Juno SR2) with the EGit plugin (2.2.0).

I have a remote repository set up using SSH, and because gitd is not setup on the remote, and because the git tools are not on the path, I have the the following settings in the config file:

[remote "origin"]
    url = ssh://moi@fully.qualified.host/home/colleague/repo.git
    fetch = +refs/heads/*:refs/remotes/origin/*
    uploadpack = ~colleague/bin/git-upload-pack
    receivepack = ~colleague/bin/git-receive-pack

Doing a plain git push from the command line displays the server's security warning then prompts me for my ssh password, then pushes flawlessly.

However inside Eclipse, I get a popup with the server warning, then I am prompted for my password as before, all appears well, then the final confirmation with the list of commits pushed is empty with an error at the top of

ssh://moi@fully.qualified.host/home/colleague/repo.git: push not permitted

I'm inside a new branch that has not been pushed to the remote as yet, if that makes any difference.

Anyone seen this before?


Solution

  • For anyone that follows down the same rabbit hole after me...

    I have found a workaround. You can't set the location of the receive and upload packs in the repository config, so this has to be removed from your config:

    [remote "origin"]
        receivepack = /blah/bin/git-receive-pack
        uploadpack = /blah/bin/git-upload-pack
    

    I'm using the Bash shell remotely, and at the start of .bashrc before it exits when the shell is non-interactive, the location gets added to the path like so:

    # If not running interactively, most of what follows is not worth doing
    if [ -z "$PS1" ] ; then
      # Make sure my extra stuff is on the path even in non-intaractive shells (I'm looking at you SSH!)
      export PATH=/blah/bin:$PATH
      return
    fi
    

    I can now push from either the local command line or via Eclipse/EGit. But of course I have reduced the security of my non-interactive shells as a compromise.