I am working on my raspberry pi server and whenever I clone or do anything on the gitremotely I want to disable password on the push and pull. How do I do that? I don't want to enter password on git shell when I try to pull or push any changes to the server.
-
"I want to disable the push and pull" What do you mean by that? That statement seems to conflict with what you are saying in the remainder of your question. – Ajedi32 Feb 22 '14 at 17:28
-
Also, are you pushing to GitHub or to your Raspberry PI server? Or are you SSH'd into your Raspberry PI server and pushing from there to GitHub? Please clarify your question. As-is it's very confusing. – Ajedi32 Feb 22 '14 at 17:30
-
I am pushing to Raspberry Pi server from git hub using git push origin master and it asks for a password. Also, I have corrected the question, I meant to say disable password on push and pull – user3302688 Feb 22 '14 at 18:31
-
Uh... you can't push *from* GitHub. GitHub doesn't let you SSH into their servers. I'm guessing GitHub (https://github.com/) has nothing to do with this question and you're just using git without GitHub? – Ajedi32 Feb 22 '14 at 18:59
-
Yes sorry I am new to this, so I did not know the difference – user3302688 Feb 22 '14 at 19:02
-
No problem. In my experience that's a fairly common mistake. I've posted an answer below that should solve your problem. – Ajedi32 Feb 22 '14 at 19:08
2 Answers
I'm not certain what your exact set up is, but it sounds to me like you want to set up an SSH key on your server. The Pro Git book covers how to do this quite thoroughly in Chapter 4.4:
Let’s walk through setting up SSH access on the server side. In this example, you’ll use the authorized_keys method for authenticating your users. We also assume you’re running a standard Linux distribution like Ubuntu. First, you create a 'git' user and a .ssh directory for that user.
$ sudo adduser git $ su git $ cd $ mkdir .ssh
Next, you need to add some developer SSH public keys to the authorized_keys file for that user. Let’s assume you’ve received a few keys by e-mail and saved them to temporary files. Again, the public keys look something like this:
$ cat /tmp/id_rsa.john.pub ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCB007n/ww+ouN4gSLKssMxXnBOvf9LGt4L ojG6rs6hPB09j9R/T17/x4lhJA0F3FR1rP6kYBRsWj2aThGw6HXLm9/5zytK6Ztg3RPKK+4k Yjh6541NYsnEAZuXz0jTTyAUfrtU3Z5E003C4oxOj6H0rfIF1kKI9MAQLMdpGW1GYEIgS9Ez Sdfd8AcCIicTDWbqLAcU4UpkaX8KyGlLwsNuuGztobF8m72ALC/nLF6JLtPofwFBlgc+myiv O7TCUSBdLQlgMVOFq1I2uPWQOkOWQAHukEOmfjy2jctxSDBQ220ymjaNsHT4kgtZg2AYYgPq dAv8JggJICUvax2T9va5 gsg-keypair
You just append them to your authorized_keys file:
$ cat /tmp/id_rsa.john.pub >> ~/.ssh/authorized_keys $ cat /tmp/id_rsa.josie.pub >> ~/.ssh/authorized_keys $ cat /tmp/id_rsa.jessica.pub >> ~/.ssh/authorized_keys

- 45,670
- 22
- 127
- 172
You need to generate your SSH keys (like @Ajedi32 exlains) or like is explained on github page : https://help.github.com/articles/generating-ssh-keys
Also currently if you type
git remote -v
you will see that your repository (origin
probably) will have pathes starting with https://github.com/user/repo.git
). This means that git on your local machine is referring to remote git repo via https
. When referring to the remote git repo via https
, git will ALWAYS ask for password.
This is why AFTER you have set up the SSH keys as described in one of the methods above, you must change the way git is referring to the remote repo from https
protocol to ssh
protocol.
To do that you first have to write down you current repo path, eg.
https://github.com/username/reponame.git
then you can convert it to the ssh
style address:
ssh://git@github.com/username/reponame.git
(mind that you only have to change username
and reponame
parts. Leave git@github.com
as it is. It always must be like this.
Then on your local machine you can type the following code: If you're on linux
git remote -v
git remote rm origin
git remote add origin ssh://git@github.com/username/reponame.git
git remote -v
The last command will print you the path via which git refers to the remote repository and it will be starting with ssh://...
.
Mind that when using command git remote -v
the repository path will be printed twice, once for fetch
and once with push
comment.

- 2,236
- 1
- 28
- 37