Created
August 16, 2017 09:35
-
-
Save boina-n/7c683b852756881dbc4f642e20c5258a to your computer and use it in GitHub Desktop.
Use ssh key with Git
This file contains hidden or 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
$ sudo su - git | |
$ cd repos/ | |
$ mkdir test-repo.git | |
$ git init --bare | |
# from the jumpbox or any server | |
# make sure the the repo host is declared in the ssh config file: | |
$ cat ~/.ssh/config | |
host myrepo | |
HostName 10.10.22.22 | |
IdentityFile ~/.ssh/gitsrv.key | |
User git | |
cd /tmp | |
git clone git@myrepo:repos/test-repo.git | |
cd test-repo | |
touch readme.md | |
echo "this is the first commited file" >> readme.md | |
git add readme.md | |
git commit -m "first commit" | |
git push | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment