Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

Recognition

  • Give kudos
  • My kudos

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

ssh -T git@bitbucket.org returns logged in as user, but git clone gives Permission denied (publickey

The question title says it all. I added my keys under my bitbucket account and as expected I can do ssh -T git@bitbucket.org to get logged in into the server and received the logged in as Satco message. But then when I try to clone a repo where I am admin, for example git clone git@bitbucket.org:Satco/perception.git I get:

13:05:46.735698 exec-cmd.c:237 trace: resolved executable dir: C:/Users/username/AppData/Local/Programs/Git/mingw64/bin
13:05:46.735698 git.c:440 trace: built-in: git clone git@bitbucket.org:Satco/perception.git
Cloning into 'perception'...
13:05:46.782564 run-command.c:663 trace: run_command: unset GIT_DIR; ssh git@bitbucket.org 'git-upload-pack '\''Satco/perception.git'\'''
git@bitbucket.org: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

 

1 answer

0 votes

Hi @Kaju Bubanja ,

Perhaps the SSH key used to connect to the repository may not be same. Therefore, could you please run the following command reviewing the SSH key used by your clone command:

ssh -v -T git@bitbucket.org

This should provide with:

debug1: Offering public key: ....
debug1: Server accepts key: ...
Enter passphrase for key '....':
debug1: Authentication succeeded (publickey).
Authenticated to bitbucket.org ([18.205.93.0]:22).

Having this information, could you please attempt on issuing the "git clone" command providing the SSH key mentioned in Offering public key?

GIT_SSH_COMMAND="ssh -i ~/.ssh/id_rsa_example -F /dev/null" git@bitbucket.org:Satco/perception.git

The command above will:

  • -i can sometimes be overridden by your config file (e.g ~/.git/config), in which case, you should give SSH an empty config file instead (e.g /dev/null
  • use the SSH key (private) provided, e.g ~/.ssh/id_rsa_example

If you continue on experiencing issues, please enable DEBUG on your Git command to review if the SSH key you are providing is the same one as the one you have on https://bitbucket.org

# on Linux (Terminal / Git Bash)
export GIT_TRACE_PACKET=1
export GIT_TRACE=1
export GIT_CURL_VERBOSE=1
# on Windows (Command Prompt)
set GIT_TRACE_PACKET=1
set GIT_TRACE=1
set GIT_CURL_VERBOSE=1

Kind regards,
Rafael

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket

Powering DevOps with Bitbucket Server & Data Center

Hi everyone, The Cloud team recently announced 12 new DevOps features that help developers ship better code, faster   ! While we’re all excited about the new improvements to Bitbucket ...

1,897 views 0 7
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you