Can somebody explain how to push files to github using ssh

Viewed 31

I already have ssh keys i already used for one pushing repository. can somebody explain how to reutilize my existing ssh key for pushing github. Detailed process for using existing ssh key.

I have ssh key, but i am unable to push my repositories to github remotely. whenever I am trying to push, it is asking for username and password for 2 times. In the 2nd time the password will be the ssh key which is added in the github right!. But it is not working. Even though before I run ssh-agent command and ssh-add command in the project folder. Please help.

2 Answers

It's possible you forgot edit your config file to .ssh/ if it's the case:

vim config ( in .ssh )

Host github.com

Hostname github.com

User git

Port 22

Identityfile /home/$USER/.ssh/$yourprivatekeyforssh

You can test your connection with ssh -T github.com

keep me posted on progress bye

First, double-check your remote URL

cd /path/to/repository
git remote -v

If it starts with https://, SSH would not be used at all.

Second, if Git, through SSH, is asking for a username/password, it means SSH defaults back to basic auth, instead of private key identity file.
That can be either because:

  • the SSH URL is incorrect and does not start with git@github.com:... (but myUser@github.com:..., which is not valid)
  • there is a permission issue in your local ~/.ssh folder
Related