Missed Team ’24? Catch up on announcements here.

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

SSH Keys for System Use - Permission Denied

Matt Runyon August 24, 2022

My goal is to use SSH keys for system use, i.e., anonymous access for non-Bitbucket users, as per the Atlassian article here: https://confluence.atlassian.com/bitbucketserver076/ssh-access-keys-for-system-use-1026534854.html

But the procedure is not working and my system access to the Bitbucket repo is denied. Here are the steps I followed:

1. Generate public+private SSH key w/ ssh-keygen -t rsa -C "my_generic_key"

2. Copy and paste the contents of the public key into Bitbucket repository via Settings>Access Keys> Add Access Key (selected Read/Write option).

3. Add the private key to the system of choice, namely Atlassian SourceTree, by going to Tools>Options>SSH key and selecting the private key file (OpenSSH is the SSH Client, though the same poblem occurs if we use Putty/Plink and use a .ppk file).

4. Attempt to Clone the Bitbucket repository via SourceTree over SSH by clicking Clone and entering the ss://git@bitbucket.... URL.

 

At step 4, a Pop-Up occurs saying "The OpenSSH agent is running but the server still rejected your connection. You may need to add the correct key to your agent by selecting Tools>Add SSH Key". Even after trying to add the SSH Key again through this recommended procedure, I have the error message "Error: git@bitbucket...: Permission denied (publickey).
fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists."

If I use PuTTY/Plink as the SSH Client, the error is different at this stage: "Output:
Error: The server's host key is not cached. You have no guarantee
that the server is the computer you think it is.
The server's rsa2 key fingerprint is:
ssh-rsa 2048 SHA256:y6OxtS49HQAqe7OHzS5JvikyL6cwQih1I/4wbcfuy4g
If you trust this host, enter "y" to add the key to
PuTTY's cache and carry on connecting.
If you want to carry on connecting just once, without
adding the key to the cache, enter "n".
If you do not trust this host, press Return to abandon the
connection.
Store key in cache? (y/n, Return cancels connection, i for more info)"

 

But there is no where to enter y/n -- this is just a weird error message from within the SourceTree GUI.

 

The repository definitely exists, and the public SSH key is definitely added to the repo. I'm at a loss.

Using SourceTree 3.4.9 on Windows 10.

0 answers

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events