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
). Did I miss something?
It is a private repository (fork of another person's private repository) and I cloned it like this:
git clone git@bitbucket.org:Nicolas_Raoul/therepo.git
Here is my local .git/config
:
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = https://Nicolas_Raoul@bitbucket.org/Nicolas_Raoul/therepo.git
[branch "master"]
remote = origin
merge = refs/heads/master
In the same environment with the same public key, Git on Github works fine.
.ssh
is rwx------
, .ssh/id_rsa
is -rw-------
, .ssh/id_rsa.pub
is -rw-r--r--
Its already answered above. I will summarise the steps to check above.
run
git remote -v
in project dir. If the output shows remote url starting withhttps://abc
then you may need username password everytime.So to change the remote url run
git remote set-url origin {ssh remote url address starts with mostly git@bitbucket.org:}
.Now run
git remote -v
to verify the changed remote url.Refer : https://help.github.com/articles/changing-a-remote-s-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:Remember, that adding additional identities (such as work and home) can be done with the
ssh-add
command, for example:Once you have confirmed which private key is being looked at locally, you can then take your public equivalent, in this case:
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.
In the HTTP request case, it is also and alternatively possible to paste the credentials (with password) directly into the url:
This will save the pain to give your credentials every times again. Simple modify your .git/config (the url).