Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Push to GitHub without a password using ssh-key

I generated an SSH key pair without a password and added the public key to GitHub.

Connection with

user@dev:/var/www/project# ssh -T [email protected] Hi User! You've successfully authenticated, but GitHub does not provide shell access. 

was successful and when I rename the key, it fails.

But when I want to push my changes, it stills ask me for my username and password combination.

Is there a way to push without a password?

like image 757
Sebus Avatar asked Feb 07 '13 22:02

Sebus


People also ask

Can I push to GitHub without password?

You can cache your GitHub password in Git: Just follow the instructions from GitHub's official documentation. After following the instructions from the above link, you should be able to push/pull to/from your repository without typing your username/password every time.


1 Answers

If it is asking you for a username and password, your origin remote is pointing at the HTTPS URL rather than the SSH URL.

Change it to ssh.

For example, a GitHub project like Git will have an HTTPS URL:

https://github.com/<Username>/<Project>.git 

And the SSH one:

[email protected]:<Username>/<Project>.git 

You can do:

git remote set-url origin [email protected]:<Username>/<Project>.git 

to change the URL.

like image 196
manojlds Avatar answered Sep 22 '22 10:09

manojlds