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--
Step 1: Install git-credential-winstore
https://confluence.atlassian.com/bitbucketserver/permanently-authenticating-with-git-repositories-776639846.html
Step 2: git config --global credential.helper 'cache --timeout 3600'
This will store your password for 1 hour
I was having other weirdness around logging in. I came across something that seemed totally dumb but worked in my case. Simply go to MacOS's keychain. Find the login lock icon in the sidebar. Click it to logout and then click to login. Sounds dumb but it solved my issues. Worth a shot.
As explained here, if you clone with SSH url, you don't need to enter username / password each time you push / pull. Check above answer by @manojlds
But if you want to clone with HTTPS and want to avoid entering username / password each time, you can store credentials into cache with below command:
git config --global credential.helper 'cache --timeout 3600'
where 3600 (seconds) means 1 hour, you may change it as per your requirement.
The following assumes command-line access via iTerm / Terminal to bitbucket.
For MacOS Sierra 10.12.5, my system manifested an equivalent problem - asking for my SSH passphrase on each connection to bitbucket.
The issue has to do with OpenSSH updates in macOS 10.12.2, which are described here in Technical Note TN2449.
You very well might want to tailor your solution, but the following will work when added to your ~/.ssh/config file:
For more information on ssh configs, take a look at the man pages for ssh_config:
One other thing: there is a good write-up on superuser here that discusses this problem and various solutions depending on your needs and setup.
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.Hello Googlers from the future.
On MacOS >= High Sierra, the SSH key is no longer saved to the KeyChain because of reasons.
Using
ssh-add -K
no longer survives restarts as well.Here are 3 possible solutions.
I've used the first method successfully. I've created a file called
config
in~/.ssh
: