出处:http://qosys.info/485/bitbucket-git-prompt-for-password
In some cases after adding public ssh keys for your Bitbucket account, Bitbucket could still fail with authentication and as a result it would prompt for your bitbucket password every time you pull or push.
Generally, in my case the problem was in https authentication, probably in your .git/config file you'll have something like this :
[remote "origin"]
url = https://fvompe@bitbucket.org/linguapic/lpc.git
fetch = +refs/heads/*:refs/remotes/origin/*
url = https://fvompe@bitbucket.org/linguapic/lpc.git
fetch = +refs/heads/*:refs/remotes/origin/*
So, here some solutions for this problem :
- Consider changing remote url in .git/config
[remote "origin"]
url = git@bitbucket.org:linguapic/lpc.git
fetch = +refs/heads/*:refs/remotes/origin/*In this way authentication still works through https and it uses your uploaded public ssh key from ~/.ssh/id_rsa.pub
- Another solution is to store plain password in ~/.netrc file, add following lines with your <login> and <password> :
machine bitbucket.org
login <login>
password <password>