Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

public ssh keys installed in repository but Bitbucket still requests password

Stan Kaufman
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 8, 2018

The problem: Despite installing public ssh keys at Bitbucket, Bitbucket is still insisting on a password for git and capistrano operations.

The situation: Trying to set up a standard Rails environment using git and capistrano: 

- Dev box (MacOS)

- Staging server (Vagrant VM Ubuntu 18.04)

- Bitbucket

Have installed ssh keys thus:

- Dev box public key on staging server and at Bitbucket

- Staging server public key at Bitbucket

Am able to ssh thus:

- From dev box into staging server and to Bitbucket

- From staging server to Bitbucket

Git can reach Bitbucket from dev box:

devbox$ git ls-remote https://myacct@bitbucket.org/myacct/project.git

933a26d21436cb95a0d4368759d34c7249d565ea HEAD

933a26d21436cb95a0d4368759d34c7249d565ea refs/heads/master

Can also do usual git procedures like git push.

However, capistrano CANNOT reach Bitbucket from dev box:

devbox$ cap staging git:check

00:00 git:wrapper

      01 mkdir -p /tmp

    ✔ 01 myacct@stagingserver 0.512s

      Uploading /tmp/git-ssh-project-staging-myacct.sh 100.0%

      02 chmod 700 /tmp/git-ssh-project-staging-myacct.sh

    ✔ 02 myacct@stagingserver 0.006s

00:00 git:check

      01 git ls-remote https://stankaufman@bitbucket.org/myacct/project.git HEAD

      01 remote: Invalid username or password. If your organization manages your account or you've enabled two-step verification, create an app password to log…

      01 fatal: Authentication failed for 'https://myacct@bitbucket.org/myacct/project.git/'

This appears not to be a capistrano problem but rather a Bitbucket problem, since from the staging server, Bitbucket asks for a password even though the server box public ssh key is installed at Bitbucket:

staging$ git ls-remote https://myacct@bitbucket.org/myacct/project

Password for 'https://myacct@bitbucket.org': 

Note: the ssh keys are assigned to the repository, not my overall account, because when I initially installed them there, I had the same problem. I also couldn't install the same key both places. Why would Bitbucket have both account-level and repository-level keys and make them exclusionary? That makes no sense, but let that pass.

Seems like something simple must be going on, but I don't find answers here:

https://capistranorb.com/documentation/getting-started/cold-start/

https://capistranorb.com/documentation/getting-started/authentication-and-authorisation/

Or in any of the other posted questions at Bitbucket.

MANY THANKS INDEED for any help!

 

1 answer

1 accepted

0 votes
Answer accepted
jredmond
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 8, 2018

You're attempting to connect via HTTPS. Change the URL in your test:

git ls-remote myacct@bitbucket.org:myacct/project
Stan Kaufman
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 8, 2018

AHA! Many thanks. I did not understand the correct syntax for specifying the repository at Bitbucket. That fixes it!

Capistrano now also works with this in config/deploy.rb:

set :repo_url, 'myacct@bitbucket.org:myacct/project'

Brilliant! THANKS AGAIN!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events