Bitbucket ssh publicly denies

Ok, so I have exhausted almost every idea and tutorial I can find on the Internet.

So basically I have a Bitbucket repository and I want to set it up to automatically update my Linux server every time someone pushes the repo.

I tried to follow this Tutorial but in step 1 of ssh I couldn't do anything.

I made an ssh key on my linux server. After that, a .pub opened, which I got and copied its contents to my BitBucket acc.

ssh-keygen -t rsa

      

After adding the pub key, I verified that it works by doing this:

ssh -T git@bitbucket.org

      

And I get a response to add the keyfingerpint host and everything is fine and I get my username that uses that key.

After that, the tutorial says to make a config file in the .ssh folder

Host bitbucket.org
IdentityFile ~/.ssh/bitbucket_rsa

      

After that he asked me to clone the repo to my server from BitBucket. And I am getting the error.

****@Main:/var/www/repo$ sudo git clone git@bitbucket.org:******/******.git
Cloning into '******'...
Permission denied (publickey).
fatal: Could not read from remote repository.

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

      

If anyone can help me, I would be more than grateful to see that I really ran out of ideas on what to do.

+3


source to share


2 answers


Your specified configuration is in your own folder .ssh

, but the clone operation is done as root (via sudo

). Therefore, this key is not relevant and is not considered for this operation.



You must copy and activate the key in /root

.

+3


source


Then the public key is not set correctly in your Bitbucket account.

https://confluence.atlassian.com/display/BITBUCKET/Set+up+SSH+for+Git

Step 6. Install the public key to your Bitbucket account



Go to Step 6 and upload your public key to Bitbucket. Then you should be able to access your repo.

Edit:

To use your private key, you must change your permissions 600

for your id_rsa file, otherwise your system will not be able to load the key.

0


source







All Articles