Skip to content

Instantly share code, notes, and snippets.

@boina-n
Created August 16, 2017 09:35
Show Gist options
  • Save boina-n/7c683b852756881dbc4f642e20c5258a to your computer and use it in GitHub Desktop.
Save boina-n/7c683b852756881dbc4f642e20c5258a to your computer and use it in GitHub Desktop.
Use ssh key with Git
$ 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