You seem to be missing the name of the repository in your git repo URI, it should have the following format:
For example, if there is a
git user on
example.com which has a git repo in
/home/git/my-repo.git, then assuming git's HOME is
/home/git, the URI would be:
Once you SSH to the server, does it have "SSH_AUTH_SOCK" environment variable defined? You can check with the following command on the deploy server:
env | grep SSH_AUTH_SOCK
If you do not have this environment variable then you are right, the agent is not being forwarded, please reply and I will ask more questions about it
If you do have this environment variable then it might be a different issue (like key mismatch), we'll look into this as well.
Assuming that all of your keys are setup correctly you might want to try the following.
Your deploy server: email@example.com Your Git User/Server: firstname.lastname@example.org Your Git repo: me/myproject.git Your SSH port: 65432
Replace the above with your own settings and on your local machine run:
$ ssh -A email@example.com 'git ls-remote ssh://firstname.lastname@example.org:65432/me/myproject.git'
If the environment variable exists, it means your SSH agent forwarding is working properly and we should look for something else.
What about what lmars suggested? Can you locally (not on the server) access the git repo using this format:
git ls-remote git@my-private-server:repo.git
If that works then try remotely using your SSH command
ssh -A email@example.com "git ls-remote git@my-private-server:repo.git"
If it does not work, it means either:
Check the Git server if it allows pubkey Authentication. Here's what you should be looking for:
$ grep PubkeyAuthentication /etc/ssh/sshd_config PubkeyAuthentication yes $ grep AuthorizedKeysFile /etc/ssh/sshd_config AuthorizedKeysFile %h/.ssh/authorized_keys
If the values do not match, change them and restart your SSH server. NOTE: Do no lock yourself out of the server, before modifying/restarting your SSH server please do these steps:
Those errors sound to me like it's using the wrong key for authentication.
How many keys do you have under your
By default it will use
You can specify the key command line like so
ssh -i /path/to/some/key -A firstname.lastname@example.org
Or in configuration file
Host mygitserver1.com IdentityFile ~/.ssh/gitkey1 Host agitserver.com IdentityFile ~/.ssh/agitserverkey
I'm assuming this is using standard port 22 as well, what are you using for git? Is it just a basic git install or are you using something like GitLab?
there can be several issues on the way, here is complete guide from github https://help.github.com/articles/using-ssh-agent-forwarding it should be same even that you are using own repo.
# ssh-add -Lyou should be able to add it with
# ssh-add yourkey
ssh:// prefix from your repo_url.
In other words, instead of this:
set :repo_url, "ssh://email@example.com:mbrictson/myrepo.git"
set :repo_url, "firstname.lastname@example.org:mbrictson/myrepo.git"