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--
Are you sure you cloned it using the ssh url?
The url for origin says url = https://Nicolas_Raoul@bitbucket.org/Nicolas_Raoul/therepo.git
so if it is using https it will ask for password irrespective of your ssh keys.
So what you want to do is the following:
open your config file in your current repo ..
vim .git/config
and change the line with the url from
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = https://Nicolas_Raoul@bitbucket.org/Nicolas_Raoul/therepo.git
to
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = git@bitbucket.org:Nicolas_Raoul/therepo.git
You are right, thanks! I had most probably clone with the wrong URL. I replaced the URL in
.git/config
withgit@bitbucket.org:Nicolas_Raoul/therepo.git
and now it works!and to change the remote using git stackoverflow.com/questions/2432764/…
It was bitbucket who suggested me https url when creating a repository! How come!
Keep in mind if your bitbucket is private, if you want to use the git protocol, you need to add you ssh key to BitBuket's website in your settings.
Had to change the URL to
ssh://git@bitbucket.org/userName/repoName.git
— withoutssh://
prefix it didn't work.