Home > Mobile >  The Problem with SSH key while Pushing repository in GitHub
The Problem with SSH key while Pushing repository in GitHub

Time:09-16

Do I need to to get the SSH key every time I push repository into git hub from git? If not how can push the repository with the same SSH key?

CodePudding user response:

I assume by "get the ssh key" you mean that you have to do

ssh-add path/to/private/key
Password Prompt

every time you log into a new session. If you don't use a package like ubuntu keyring, you'll have to manually load your private key in each session. You can make this easier by creating an ssh_config file like this:

Host github.com
    HostName github.com
    IdentityFile /home/USERNAME/.ssh/github_private_key

And place this into /home/USERNAME/.ssh/config and you public and private key into the same folder. Then you should only be queried for the password when you use it, without having to bother with the ssh-agent separately.

If however, you mean being asked for your github username and password everytime, yes HTTPS-git will always ask for your credentials. Just set up ssh-keys as above and register the public key with github; if you don't specify a password for the private key(not recommended), you won't be asked for a password again when pushing-pulling to/from github. Also see this guide on github.

HTH

  • Related