About these instructions
Whether setting up Git on an OSX or Ubuntu operated machine, the following instructions will be run from you computer's terminal prompt. It is also important to remember that when following these instructions, to only run one command at a time.
The beginning of a command is denoted by the
$ symbol in the instructions; some instructions have more than one command to run per step. This symbol has been placed in the instructions to dictate where a new command starts and to emphasise that these commands are to be run in your terminal prompt. As such, when copying any commands, do not include the
We will be using Git for our version control system so we need to set it up to match our Github account.
If you haven't already created a Github account, please do so here before continuing on.
Once you have created a Github account, open up your terminal prompt on your computer and run the commands listed below. IMPORTANT: Replace the example name and email address in the commands with the name and email used to create your Github account; both the name and email must be wrapped in "quotations"
$ git config --global color.ui true
$ git config --global user.name "YOUR NAME"
$ git config --global user.email "YOUR@EMAIL.com"
$ ssh-keygen -t rsa -C "YOUR@EMAIL.com"
The steps above create a new SSH key, using the provided email as a label. When you're terminal prompts you to "Enter a file in which to save the key", press the enter key to skip:
# Enter a file in which to save the key (/Users/you/.ssh/id_rsa):
When your terminal prompts you to "Enter passphrase", press the enter key to skip:
# Enter passphrase (empty for no passphrase):
# Enter same passphrase again:
The next step is to take the newly generated SSH key and add it to your Github account. To retrieve that key, run the following command:
$ cat ~/.ssh/id_rsa.pub
Once run, your terminal spit out a key similar to the example below...that is your SSH key:
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC/p2JXhE3L0RRzTilFhpmuOFGulRvQKWBD+fOmLP92n3ROwiRkukXQSxCj7S6oti0esn6ibvZJLGxSIiiXwgLb5+AaINGlF2UgD3S7K8iqREdpkvw6QdgHScrniKOcAKEJ4VHzsNLWuG8GtmjNk3uKIfEPjP3S0K/vt956Ns4dsDCC9eIvRKwN8amug6qW1ro70t3GkzbT/75veNwrdx9GOwkTBN/U604GZ5QD6qR/FjHz3gv1SkP6zahiSfCv1vJJ1WsmISEQSNMzlb6s7hK0WPaYX41Lg2on9j3JcmxJwWcDIz+EeWRI7Idz2Sy/QZFkc/LDcuaARW4mBM5Psk8twScW3/G+vRFkR1qMl+vZPNRRsTnSSKntQuR6rdXN/Ltw90hjGo/JDcM7qowZQFiMx7FoL2sihjcik7IiH9G+Y8Vn7PB+KCiTbB22EZ5i2mgOrwVByUdNYFhtqa8S6Ks1jnNnANE/T635XQ3/bRAcRNXs2aBA4rgQ3qVwjHieXQQ77lhJHI3iEFt9eQiF/6Vz3ZDDghYHwnXV+wEyi6CA3i62Yq8wOxgkyWljNwVza3iVGZdSnkYR9V20y48izioSxe8xWcbiwwowR2nVsI/cSs7uCSlfiN3zcmFUWF+x5c/4G7lQeMruW+pOcahvYIPa7QpkwEUPO8SGI74fPsTsfw== firstname.lastname@example.org
Copy what has been returned to you in your terminal and add it to your Github account. To do this, go to Github, click on your profile icon in the top right-hand corner and select Settings:
In your Github profile click on SSH and GPG Keys:
Click on the New SSH key button in the top right-hand corner of the page:
Give your key a Title and then paste the key into the Key section. Once added, click on the Add SSH key button.
To verify that everything is working correctly, return to your terminal and run the following command:
$ ssh -T email@example.com
If you get the message below, just type yes and press the enter key to continue:
# The authenticity of host 'github.com (22.214.171.124)' can't be established.
# RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
# Are you sure you want to continue connecting (yes/no)?
At this point you should receiving the following output in your terminal prompt:
# Hi "your-username!" You've successfully authenticated, but GitHub does not provide shell access.
Congrats! You have just configured your git.