I uploaded my ~/.ssh/id_rsa.pub
to Bitbucket\'s SSH keys as explained, but Git still asks me for my password at every operation (such as git pull
).
If you are using a Ubuntu system, use the following to Store Password Permanently:
git config --global credential.helper store
I logged in using my username instead of email and it started working.
In the HTTP request case, it is also and alternatively possible to paste the credentials (with password) directly into the url:
http://username:password@bitbucket.org/...
This will save the pain to give your credentials every times again. Simple modify your .git/config (the url).
You may need to double-check your SSH identities file. You may be guiding BitBucket to look at a different/incorrect private key to the equivalent public key that you have saved on BitBucket.
Check it with tail ~/.ssh/config
- you will see something similar to:
Host bitbucket.org
HostName bitbucket.org
IdentityFile ~/.ssh/personal-bitbucket-ssh-key
Remember, that adding additional identities (such as work and home) can be done with the ssh-add
command, for example:
ssh-keygen -t rsa -C "companyName" -f "companyName"
ssh-add ~/.ssh/companyName
Once you have confirmed which private key is being looked at locally, you can then take your public equivalent, in this case:
cat ~/.ssh/personal-bitbucket-ssh-key.pub | pbcopy
And paste that cipher onto BitBucket. Your git pushes will now (provided you are using the SSH clone as aforementioned answers have pointed out) be allowed without a password, as your device is a recognised friendly.
Hopefully this helps clear it up for someone.
With me, although I ran 'git clone ssh://git@stash.xxx.com:7999/projName/projA.git' I was still being prompted for password for this new repo that I cloned, so by comparing its .git/config file to other repos that work, It turned out to be the url under the [remote "origin"] section, it was set to the ssh path above for the new repo, but was set to https:xxx for the working one.
Actually, none of these answers reflect current state of the art with Git (v2.29 by time of writing this answer). In the latest versions of Git, cache
, winstore
, wincred
are deprecated.
If you want to clone a Bitbucket repository via HTTPS, e.g.
git clone https://Kutlime@bitbucket.org/SomeOrganization/SomeRepo.git
.gitconfig
accordingly (global or local)[credential]
helper = manager
You can locate your .gitconfig
by executing this command.
git config --list --show-origin
git clone https://Kutlime@bitbucket.org/SomeOrganization/SomeRepo.git
and wait until log on window appears. Use your user name from the url (kutlime in my case) and your generated app password as a password.