You could tell git to store your credentials using the following command:
# git config --global credential.helper store
Using this method, you only need to enter your username and password once and git will never ask for it again.
You can also go for caching instead which will store your password after having typed it once in a session for some period of time.
# git config --global credential.helper cache
You can set the timeout yourself if your not happy with the default:
# git config --global credential.helper 'cache --timeout=600'
Once again this is not always ideal.
What you should really be using is the ssh protocol to push and pull your data. This should work with proxies without any issues so you should definitely give it a go.
You can set it up by setting your remote url as follows:
# git remote set-url origin git@github.com:<username>/<project>.git
If you are using another hosting service like bitbucket, just replace "github.com" with your providers domain.
Once you do that, you will need to set up a public and private key pair for communication between github and your computer. There is a very good tutorial on how to set it up here. If you are using Linux or MacOSX you simply need to follow the steps when running the command ssh-keygen.
After that, you can get an ssh agent to store your password for you which is typically more secure. Ssh agents usually ask you to input your password just once after turning on your computer - but after that it should do everything automatically for you.
The ssh agent you use will depend on your operating system but it shouldn't be hard to set up.
http://stackoverflow.com/questions/18672787/how-to-make-git-only-ask-password-when-push-to-remote-repository
https://help.github.com/articles/generating-ssh-keys/
Saturday, December 27, 2014
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment