Previous Tutorials:
- Version Control Basics
- GitHub Desktop installed
- GitHub Account created
- Unity Core Concepts (Official Unity Tutorial)
- Unity installed
- Unity account created
Step 1 – Open GitHub Desktop
Step 2 – Create a new repository for your project

Name your repository based on your game’s name. You might want to add the word “Repo” at the end so you can tell the difference between this folder and the project folder. It’s also very important to add the Unity .gitignore at this step.

DEFINITION – GITIGNORE
A .gitignore file tells the version control system that it should not pay attention to certain files. This is useful for files that are generated when the game is built, or for temporary files.
This file is vital. Without it, very large temporary files will be added to your version control project every time you make a commit, and you also won’t be able to commit while Unity is open. There is no easy way to remove these files if you accidentally forget the .gitignore and commit them, either! So make sure to always remember this step.


IMPORTANT
If you are using Fife College computers, remember that you must put your repository in your U drive and NOT in your Documents or Desktop folders in order for GitHub Desktop and Unity to work.
Step 3 – Open Unity Hub
Step 4 – Create a new Unity project

The new Unity project should be located inside your repository’s folder. You can tell it’s in the right place if the folder containing your new Unity project is next to the .git folder. Use your game name for your Unity Project name. You may also want to name your Unity Project with the word “Project” at the end to differentiate it from your Repo folder.


REMINDER
In order for something to be tracked by version control, it must be inside the repository’s folder. Nothing outside will be tracked! The repository folder is the one with the hidden .git folder inside it – remember not to put anything in the .git folder itself!
Step 5 – Move your .gitignore
Copy the .gitignore folder from your Repository folder into your Unity project folder. This step is very important – the .gitignore file will not work correctly unless it is inside the Unity Project folder!
Step 6 – Make your initial commit
Once you get a new, blank project setup, the first thing to do is always make an initial commit just saving the setup to version control. To do this, go back to GitHub Desktop. You should see some changed files in your repository.

REMINDER
If GitHub is not on the Changes view, remember that you can get there by choosing the “Changes” tab in the top left area.
In the “Changes” section, you should see around 24 files. This will include all of your blank Unity project’s files, as well as your .gitignore file.


WARNING
If you see closer to 100 files and any have long names with strings of random letters and numbers, this means there is something wrong with your .gitignore file! Go back to the previous step and check it carefully.
Once you have checked that your .gitignore is working, leave all of the files ticked, add a commit message (something like “Created blank Unity project”), and make your commit!

Step 7 – Push to GitHub
With your commit made, you should now push your project up to GitHub’s online version of your repository. Click “Publish” in the top of the window (remember in the future it will say “Push” instead). You can check on the GitHub website to ensure your repository is correctly backing up the files.

IMPORTANT
Un-tick “Keep this repository private” for any repositories you need to share with others, such as those for coursework. You can add people to a repository but it’s much easier if it is just public. This is a setting that can be changed later, if needed.

Further Reading
- Other version control tutorials
- Unity Editor – Importing Assets