Skip to main content

Exercise 1: Clone, commit, pull, push

Getting started

Step 1: Get yourself on Github! Go to https://github.com/ and make yourself an account, if you don't already have one.

Step 2: Click HERE and leave a comment on the issue (include your name so I know who you are, please). This is just so I know your Github username and I can add you as a collaborator. This is important - because even though you can see all the code right now, you won't be able to push any of your changes until you've been added.

Setting up the git user

Before we can start using git, we have to tell it our name and email address. Weirdly, this isn't actually related to your Github account - it's just an identifier that it will put next to your commits (you know, so your friends know who to blame when the project breaks!).

Open Git Bash if you haven't already. This will give us a command line interface - it's a text-based way of navigating our folders and running programs. To run a command, you type it and then press enter.

To set the user name, use this command:

git config --global user.name "Replace this text with your name"

Don't forget to replace the text in quotes with your actual name! For example, I would put:

git config --global user.name "Delia Hamwood"

Then set the email address. This can be any address you use, it doesn't have to match your Github account:

git config --global user.email replacethis@example.com

Replacing the fake email with your real one. Mine would look like this:

git config --global user.email d.hamwood@lcc.arts.ac.uk

Cloning the project

Now git knows who we are, we need to navigate to the folder we want to put the documents in. Let's put this one in our Documents folder. Type this and press enter:

cd Documents

Now you should be in the Documents folder - we're ready to to clone the project. Here's the command:

git clone https://github.com/creativetechnologylab/LCCUnityGitWorkshop.git

Wondering where I got that URL? There's a button on the project page for "clone or download" which gives you the link - you can get the clone URL for any project that's publicly available on Github, even if you aren't a collaborator!

Screenshot-2020-01-19-at-214833.png

Making changes and committing them to the local repository

Syncing up with the remote repository

Additional resources: