-
Create GitHub repository in github and save the SSH repository url
-
Init git on server in code directory
git init
- Create SSH keys on the server
ssh-keygen -t rsa -b 4096 -C [email protected]
- Rename the key that doesn't end with
.pub
torepo-name.deploy.pem
- Save
.pub
file content to your local client for use later - Move
.pem
key to~/.ssh/
or suitable location - Change key file permission:
sudo chmod 400 repo-name.deploy.pem
- Create ssh-config file
- Navigate to
~/.ssh
andtouch config
set permissionsudo chmod 644 config
- Add entry in config file
Host gitreponame
Hostname github.com
IdentityFile ~/.ssh/repo-name.deploy.pem
-
Add the content from the public key file i.e.
.pub
to your github repository,settings > deploy keys > Add deploy keys
-
Set the remote git repository url on the server for the initalized git repo
git remote add origin git@gitreponame:organization-name/repo-name.git
or if already existinggit remote set-url origin git@gitreponame:organization-name/repo-name.git
- test with:
git remote -v
- Add files to commit and push them to the master branch
git add .
git commit -m 'root commit'
git push -u origin master
What is the difference between "remote" (see https://gist.github.com/Nilpo/8ed5e44be00d6cf21f22#su)
and "deploy keys"?
Were are 4 ppl working on a JS project and want the possibility to push it to live (see link), when needed.
Thank you