Reputation: 708
I have done the following steps to setup ssh deployment keys with our git repo for it to be able to git pull without a username and password:
Note: I am on AWS EC2 / Ubuntu 14.04.3
ssh-keygen -t rsa -b 4096 -C "[email protected]"
these are then saved as id_rsa and id_rsa.pub in ~/.ssh/sudo git pull [email protected]:ownersUsername/OurRepo.git
and get the following errorPermission denied (publickey). fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.
Another Note: This repository is private under another users account.
Also, when I try ssh [email protected]
I get:
Hi userName/Repo! You've successfully authenticated, but GitHub does not provide shell access. Connection to github.com closed.
And the deployment key comes up as being used. Have been on this issue for greater than 4 hours now and any would would be very much appreciated, thanks.
Upvotes: 6
Views: 9090
Reputation: 99224
The problem is you're using sudo, which runs the command as root, and it will try to use the root's keys not your user's keys.
What you want to do is:
/var/www
Upvotes: 8
Reputation: 142064
When you do a git pull you don't need the link.
git pull <remote> <branch>
You need the full url for the clone command
sudo git clone [email protected]:ownersUsername/OurRepo.git
To test if your ssh key is good use this:
git fetch --all --prune
Upvotes: 0