Reputation: 16339
I want to set my password on push only not for pull.
Is there any way to do that?
Upvotes: 0
Views: 446
Reputation: 497692
If you have two different ways of interacting with the remote repository, one of which requires a password (for pushing) and one of which doesn't (for pulling) you can do this:
[remote "origin"]
# the lightweight git protocol doesn't use passwords
# this will be used for fetch/pull
url = "git://git.foobar.org/foobar"
# this line is there by default; don't mess with it
fetch = +refs/heads/*:refs/remotes/origin/*
# SO, that's not a C comment... */
# ssh requires password/key
# this will be used for pushes
pushurl = ssh://[email protected]/foobar
Substitute the correct URLs in there, and you should be good to go.
Upvotes: 2