3  Setting up a GitHub Account

It’s very easy to get set up on GitHub. Just click the link above and select the package you’d like. If you have an academic email address, consider making this your primary email address on the account, as it gives you a PRO account for free with access to more features. See here for more details about the differences. If you are a student, you should also sign up for the GitHub Student Developer Pack as this gives you free access to a bunch of useful tools, such as the GitKraken Git client mentioned earlier. If you are a teacher, you get access to a GitHub Teams account, which also comes with its own set of benefits (see here for more details).

Be sure to choose a user name that is easy to remember, and easy to find. I would suggest just using your name, or the username you have for other work-related accounts (e.g., Twitter). It’s quite annoying to try and change this later, so spend a little time thinking about it now.


You can choose a public-facing name that is different to your username, so you can just use your full name here if yours is long and you don’t want to use it as your username.

Now you have a GitHub account set up, this is your remote. If you work on a project with collaborators, this can be shared with them. That way, collaborators can work on their own versions of the code on their local machine (computer), and when it’s ready for other people to use/help write, they can push it to the remote where others can access it. Don’t worry if you don’t know what push is - we’ll cover that soon.

3.1 Linking Git to GitHub

Now you have a GitHub account, you need link it to your local Git installation. There are a couple of different methods for doing this. The first is to use HTTPS and Personal Access Tokens (PATs). This is somewhat easier to set up, but it’s a little less secure and ultimately is more annoying to use as it often requires entering your username and password each time you connect to GitHub. The second is to use SSH, which is a little more complicated to set up, but is more secure and easier to use once it’s set up. Unlike Jenny Bryan, I think it’s worth the effort to set up SSH as you front load the work (though it’s not too bad), and then you can just forget about it. Knowing SSH basics is also really useful as it’s the basis for many other things, such as connecting to remote servers and computing on clusters, so will serve you well moving forward.

Instead of trying to cover all eventualities for all operating systems, please work through the excellent GitHub docs on PATs and SSH. If you are having issues after working through the steps, then try reading Jenny Bryan’s excellent Git guide, which covers both PATs and SSH. If nothing here works, let me know and I’ll try to help!


If you use the GitKraken client (detailed here), you can use the instructions in their documentation to create and pass the SSH keys directly to GitHub. This assumes you have linked GitKraken to your GitHub account.

That being said, here’s an outline of the steps you’ll need to take to set up SSH (that are lightly edited from the GitHub documentation). If on Mac/Linux, this will be in the terminal, and if on Windows, this will be in Git Bash.

  1. Create a new SSH key
# -t specifies the type of cryptography the key will use (ed25519 is more secure than the default RSA generated and recommended by GitHub)
# -f specifies the file name to save the key to
# -C specifies the comment to add to the key i.e., your GitHub email address
ssh-keygen -t ed25519 -f ~/.ssh/github -C "[email protected]"

If you’re on MacOS, edit the ~/.ssh/config file using the open/vi/nano commands e.g., open ~/.ssh/config to add the following lines:

Host github.com
  AddKeysToAgent yes
  UseKeychain yes   # delete if you're not using a password for the SSH key
  IdentityFile ~/.ssh/github

If the file doesn’t exist, you can create it using touch ~/.ssh/config.

  1. Start the SSH agent:
eval "$(ssh-agent -s)"
  1. Add the SSH key to the SSH agent:
## --apple-use-keychain tells the agent to use the macOS keychain to store the passphrase for the key
# Omit if you're not using a password for the SSH key, or if you're using Windows/Linux
ssh-add --apple-use-keychain ~/.ssh/github
  1. Copy the public key contents to your clipboard:
# print contents to terminal to manually copy
cat ~/.ssh/github.pub
  1. Navigate to the Settings > SSH and GPG Keys section of your GitHub account and click the New SSH key button. Paste in the contents of the public key you copied earlier, and click save.

It would be useful to add GitHub’s public key fingerprints to your known_hosts file, so that you don’t get a warning when you connect to GitHub. You can find the fingerprints here.

Currently, you should edit the ~/.ssh/known_hosts file to add the following lines:

github.com ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOMqqnkVzrm0SdG6UOoqKLsabgH5C9okWi0dh2l9GKJl
github.com ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBEmKSENjQEezOmxkZMy7opKgwFB9nkt5YRrYMjNuG5N87uRgg6CLrbo5wAdT/y6v0mKV0U2w0WZ2YB/++Tpockg=
github.com ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCj7ndNxQowgcQnjshcLrqPEiiphnt+VTTvDP6mHBL9j1aNUkY4Ue1gvwnGLVlOhGeYrnZaMgRK6+PKCUXaDbC7qtbW8gIkhL7aGCsOr/C56SJMy/BCZfxd1nWzAOxSDPgVsmerOBYfNqltV9/hWCqBywINIR+5dIg6JTJ72pcEpEjcYgXkE2YEFXV1JHnsKgbLWNlhScqb2UmyRkQyytRLtL+38TGxkxCflmO+5Z8CSSNY7GidjMIZ7Q4zMjA2n1nGrlTDkzwDCsw+wqFPGQA179cnfGWOWRVruj16z6XyvxvjJwbz0wQZ75XK5tKSb7FNyeIEs4TT4jk+S4dhPeAUC5y+bDYirYgM4GC7uEnztnZyaVWQ7B381AK4Qdrwt51ZqExKbQpTUNn+EjqoTwvqNj4kqx5QUCI0ThS/YkOxJCXmPUWZbhjpCg56i+2aB6CmK2JGhn57K5mj0MNdBXA4/WnwH6XoPWJzK5Nyu2zB3nAZp+S5hpQs+p1vN1/wsjk=
  1. Test you can connect to GitHub using SSH:

If you’re on Windows, you will need to start the ssh-agent service before you can use SSH i.e., when you want to use GitHub. This can be done by running eval$(ssh-agent -s) in Git Bash. However, you can automate this every time you open Git Bash by adding the following line to your ~/.bashrc file:


agent_load_env () { test -f "$env" && . "$env" >| /dev/null ; }

agent_start () {
    (umask 077; ssh-agent >| "$env")
    . "$env" >| /dev/null ; }


# agent_run_state: 0=agent running w/ key; 1=agent w/o key; 2=agent not running
agent_run_state=$(ssh-add -l >| /dev/null 2>&1; echo $?)

if [ ! "$SSH_AUTH_SOCK" ] || [ $agent_run_state = 2 ]; then
elif [ "$SSH_AUTH_SOCK" ] && [ $agent_run_state = 1 ]; then

unset env