Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git private repos without password

Tags:

git

github

I work on private git repos from github and everytime I pull or push I need to type my github username and password. Is there a way to make it not to ask for password every time?

I using Xubuntu GNU/Linux with command line.

like image 817
jcubic Avatar asked May 22 '14 12:05

jcubic


2 Answers

I'd use SSH connection rather than HTTPS.

Just create a key, give it to Github you should be good to go: https://help.github.com/articles/generating-ssh-keys

Update:

If you are already using HTTPS, you can easily change the remote's url to SSH:

git remote set-url origin [email protected]:user/repo.git

Now you will be able to push/pull over SSH. More information can be found on Github

If you are cloning a new repo, make sure to use SSH clone url provided by Github on the repo's page.

like image 114
PericlesTheo Avatar answered Sep 22 '22 07:09

PericlesTheo


From the github website: https://help.github.com/articles/set-up-git#platform-linux

Password caching

The last option you set will tell Git that you don't want to type your username and password every time your computer talks to GitHub.

Tips:

You need Git 1.7.10 or newer to use the credential helper. The credential helper only works when you clone a GitHub repository using an HTTPS URL. If you clone GitHub repositories using SSH, then you authenticate using SSH keys instead of a username and password. For help setting up an SSH connection, see Generating SSH Keys. To use this option, you need to turn on the credential helper so that Git will save your password in memory for some time:

git config --global credential.helper cache
# Set git to use the credential memory cache

By default Git will cache your password for 15 minutes. You can change this if you like.

git config --global credential.helper 'cache --timeout=3600'
# Set the cache to timeout after 1 hour (setting is in seconds)
like image 24
mattwise Avatar answered Sep 24 '22 07:09

mattwise