Skip to content

Downloading your git repository

K Clough edited this page Sep 10, 2025 · 20 revisions

You now want to get your fork of the repository into your local computer space, i.e. somewhere on your own computer.

Set up your identity

Go back to the terminal and check that you are in your virtual environment.

So that git can identify you when you push and pull changes to your repository, you need to set up a user name, and the email you registered your username with.

You only need to do this once - it will be stored in your directory in a hidden folder so that it is accessible to git the next time it is used.

Authenticating your identity via git

Cloning a public repository does not usually need authentication, because it is open to everyone. However, if you try to do anything to your repository that needs authentication, such as pushing changes to your fork, you will need to authenticate yourself. There are various ways to do it, detailed here.

Here I will tell you two ways - the first - ssh keys - is preferred but the second - access token - is more foolproof.

SSH keys

You will need to generate an SSH public/private keypair on your local machine (the one you want to get the files onto) and add the public key to your account on GitHub.com.

Very clear instructions are given here, but here are some specific instructions for the lab computers/AppsAnywhere:

  • Make sure you are in your virtual environment, the one with git installed, so that it recognises ssh

  • Create the key pair by typing: ssh-keygen -t ed25519 -C "[email protected]" as in the instructions

  • Press enter when prompted about the location - this will store the public part of the key in the location ~/.ssh/id_ed25519.pub.

  • You will need to copy the contents of this public file into your GitHub profile as detailed here. This can be a bit fiddly, as you want to copy the very long id in the file and not type it out. I recommend copying the public file to your current location using

cp ~/.ssh/id_ed25519.pub .

And then opening it using a text editor. In AppsAnywhere if you do everything (including logging into GitHub in the AppsAnywhere browser) it should paste across ok.

Every time you use Git to authenticate with GitHub, you'll be prompted to enter your SSH key passphrase, unless you've stored the key. Do not ever create an ssh key without a passcode, and never share the private key with anyone (the one without a .pub at the end.

Personal token

An alternative is to use HTTPS and create a personal access token because it works on most systems, even ones with firewalls.

Once you have a personal access token, you can enter it instead of your password when performing Git operations over HTTPS.

For example, to clone a private repository on the command line you would enter the usual git clone command. If you are then prompted to enter your username and password, you enter your personal access token instead of a password.

G:/> git clone https://github.com/USERNAME/REPO.git
Username: YOUR_USERNAME
Password: YOUR_PERSONAL_ACCESS_TOKEN

The key thing to realise here is that your GitHub login password will not work here. It has to be a token that you generated.

Clone repository:

To download a copy ("clone") a repository you type:

git clone <ssh or https path copied from the git repository webpage using the green code button>

For example to get your fork using ssh authentication you would do something like:

git clone [email protected]:DrFluffyCat/TopicsInSciComp.git

This will make a folder called TopicsInSciComp with all the contents of the repository in it - try accessing some of the python notebooks contained in it by typing jupyter notebook and then opening them through the browser window that appears.

Clone this wiki locally