Add the following in ~/.ssh/config:

     User git
     IdentityFile ~/.ssh/id_rsa_mypvtkey

Note that the “Host” line is important, and cannot be just about any string (for git. For ssh it didnt matter). I found that git would ask me for a password if the Host line was something other than the actual hostname, even if the “Hostname” line was correct.

So, Host and Hostname should be the server address (name or IP)

If the ‘config’ file contains the proper lines, ssh-add isnt required.

Now add the key to ssh:

ssh-add ~/.ssh/id_rsa_mypvtkey