0

We have a setup where our git server needs the publickeys to authenticate in order to push or pull. I am trying to do so on one of our servers and can't figure out why it isn't working. I have searched and searched and everything I have found says to just run ssh -A when logging into the server and that should forward what is needed to allow git operations, but it isn't working.

On my local machine, I can cd into a directory, run git push origin master type in my password for ~/.ssh/id_rsa and it works perfectly.

When logging into the server I tried using ssh-add ~/.ssh/id_rsa putting in my password, then running ssh -A [user]@[server] and it logs in fine, I then cd into the directory and run git pull to which I am given permission denied (publickey)

I can't figure out why it is not allowing me to push or pull from the server, it works locally, and I am using the -A flag when ssh-ing into the server, but always permission denied (publickey)

Hopefully someone much more skilled in server stuff can see that I am just doing something wrong and it's an easy fix. Thank you all, I appreciate the time and help

2 Answers2

0

Use GIT_SSH_COMMAND="ssh -v" git pull to get verbose output from ssh.

AlexD
  • 8,747
  • 2
  • 29
  • 38
0

I honestly don't understand your setup completely, but in general I can recommend using a SSH config file for such use cases.

For example if your server name is my-server.com, it could look like the following:

Host my-server.com
 HostName my-server.com
 Port 22
 IdentityFile ~/.ssh/id_rsa

It will prompt you for your passphrase for the private key.

julid
  • 36
  • 1