I'm trying to connect git using SSH on ubuntu EC2 instance.
I tried with following steps, I'm getting public key error.
when i run command ssh -T git@bitbucket.org , i see following result,
logged in as user-name You can use git or hg to connect to Bitbucket. Shell access is disabled
If i do git pull in project directory, I'm getting error
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.
Help me to get rid of this error.
Note: I tried with following solution, it didn't work. git push origin master: permission denied (public key) error
Note (Updated):: It works in my local machine(windows) with SSH key.
You might need to change the permission of keys and folder.
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
You may also need to change the permissions of your home directory and remove write access for the group and others.
chmod go-w ~
This helped me answer your question.
I tried with following solution, it worked.
sudo su - root # switch to root user
cat ~/.ssh/id_rsa.pub # create if not already existing
sudo su - ubuntu # switch back to normal user
This is referred from Unable to add ssh-key of EC2 instance to bitbucket account
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.