Reputation: 653
Ok so I've run out almost on every idea and tutorial I can find online.
So basically I have a Bitbucket repo and I want to set it up to automaticly update my linux server each time someone pushes to the repo.
I was trying to follow this Tutorial but at step 1 ssh, I failed to do anything.
I made an ssh key on my linux server. After that opened the .pub one I got and copied its content to my BitBucket acc.
ssh-keygen -t rsa
After the pub key has been added I verified that it is working by doing this:
ssh -T [email protected]
And I get a response to add the hosts keyfingerpint and everything is OK and I get my username returned that is using that key.
After that the tutorial said to make a config file in .ssh folder
Host bitbucket.org
IdentityFile ~/.ssh/bitbucket_rsa
After that it said to try and clone the repo to my server from BitBucket. And that's were I get the error.
****@Main:/var/www/repo$ sudo git clone [email protected]:******/******.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 seeing that I really have run out of ideas what to do.
Upvotes: 3
Views: 219
Reputation: 91017
Your said config is in your own .ssh
folder, but the clone operation is performed as root (via sudo
). So this key isn't relevant and not considered for this operation.
You should copy and activate the key in /root
.
Upvotes: 4
Reputation: 27295
Then the public key isn't set correctly in your Bitbucket account.
https://confluence.atlassian.com/display/BITBUCKET/Set+up+SSH+for+Git
Step 6. Install the public key on your Bitbucket account
Go to Step 6 and upload your public key to Bitbucket. Then you should have access to your repo.
Edit:
To use your private key you should change your rights to 600
for your id_rsa file otherwise your system can't load the key.
Upvotes: 0