GitHub Terminal Cheatsheet

Helpful terminal commands when using Git

Rob Johnson

By Rob Johnson

Fri Jul 07 2017

#git

Setting up git on a remote server

When setting up git on a server for the first time, first initialize git in the root directory of your project. E.g. /var/www/html. I prefer to initialize git before adding any source code and the instructions below reflect this.

# then initialize the git repo
git init

# now clone the project from your git repo into the directory
git remote add origin [email protected]:username/repository

Check to see if GitHub has your SSH key

Check to see if your machine has SSH keys stored on GitHub. It will attempt to ssh to GitHub Enterprise

ssh -T git@hostname

You should see something like this if you already have an SSH ket installed

The authenticity of host 'hostname (192.30.252.1)' can't be established.
RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)?

Type yes and you should see

Hi username! You've successfully authenticated, but GitHub does not provide shell access.
# commerce 14 # seo 5 # tools 6 # amazon 1 # sql 4 # shopify 9 # javascript 13 # projects 4 # css 2 # git 2 # php 3 # analytics 4 # api 6 # monitoring 2 # python 2 # aws 2