Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Still requiring login after SSH authentication

Tags:

github

ssh

People also ask

Why does SSH keep asking for passphrase?

There may be times in which you don't want the passphrase stored in the keychain, but don't want to have to enter the passphrase over and over again. This will ask you for the passphrase, enter it and it will not ask again until you restart.

How do I get Git to stop asking for password?

You can avoid being prompted for your password by configuring Git to cache your credentials for you. Once you've configured credential caching, Git automatically uses your cached personal access token when you pull or push a repository using HTTPS.

Why does my SSH key not work?

Make sure the authorized_keys file and the private key itself have the correct permissions and ownership. Check that key-based authentication is allowed by the server. Make sure the private key is readable by the SSH client. If you're using PuTTY, make sure your SSH keys are properly configured for the session.


Check your remotes via git remote -v.

https:// URLs will always ask for a password, unless you configure a credential helper. More info on that in this question.

The simplest solution for password-less git access would be to use the git remote set-url command and set an SSH url for the existing repo.

In your case, git remote set-url origin [email protected]:name/repo.

Then you should be able to git push origin <branch> without being asked for a password.


Good that you have correctly setup your git ssh now you need to reclone the git repository with ssh for example previously you would have done something like this :

git clone https://github.com/dangrossman/bootstrap-daterangepicker.git

this was a https clone now you need to clone with ssh as

git clone [email protected]:dangrossman/bootstrap-daterangepicker.git

you can find the ssh link from your github account same place where you found your https link. After this you can easily push without your password prompt .

It might though ask for your ssh unlock password. You then need to enter the paraphase you gave during the creation of your ssh key . If you left it blank it might not prompt for it .


I was able to stop the username & password prompt by opening .git/config from the base repo directory and changing the remote URL.

For example:

[remote "origin"]
    url = https://github.com/username/my-repo.git

should be changed to:

[remote "origin"]
    url = [email protected]:username/my-repo.git

I tried the answer marked as correct but couldn't make it work. This worked for me instead git remote set-url origin ssh://[email protected]/username/reponame