Created
January 22, 2019 16:43
-
-
Save andrerfneves/027d89bed64a9f751ec5db2973ea0db5 to your computer and use it in GitHub Desktop.
EC2 Git Clone
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Private Repository | |
In case our Github code repository is private, then cloning it on EC2 will fail. | |
In order to make it work, we will need to provide SSH access to the EC2 instance to login and clone the repo. Follow the steps in Generating SSH Keys to add SSH keys but here is the gist: | |
First create the SSH keys on EC2: | |
ls -al ~/.ssh | |
ssh-keygen -t rsa -C "[email protected]" | |
eval "$(ssh-agent -s)" | |
ssh-add ~/.ssh/id_rsa | |
cat ~/.ssh/id_rsa.pub | |
Then, add a new SSH Key into github by following the steps on the github website. | |
Finally, back on the EC2 server, test if SSH access works | |
ssh -T [email protected] | |
Now trying cloning it... | |
git clone [email protected]:gautamarora/todos.git | |
and it should work! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment