Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to automatically authenticate into GitHub from Git Bash using my Public and Private Keys instead of username and password?

Every time when I write

git pull origin master

or

git push origin master

or anything else in Git Bash I have to insert my username and password to login into GitHub.

I would like instead to automatically authenticate into GitHub using my Public and Private Keys.

I've already created the keys. They are into my local machine under ~/.ssh. I've attached the public key to my account as well. But I'm always asked for the username and password instead.

What do I still have to do to be able to login direct with the keys? Many thanks!

like image 827
Aloysia de Argenteuil Avatar asked Feb 03 '15 12:02

Aloysia de Argenteuil


1 Answers

Based on this post https://stackoverflow.com/a/15034499 we learn that git won't ask for user and password only if the repository is configured to use ssh and NOT https.

We can change this using: git remote set-url origin [email protected]:user/repo.git

like image 193
Aloysia de Argenteuil Avatar answered Nov 20 '22 00:11

Aloysia de Argenteuil