Getting setup with Unity and Git — Part 1

Version Control Systems (VCS) have become a fundamental concept in the Software Development industry as it allows multiple people to work on the same project simultaneously. This can be done while maintaining an overriding (or most up-to-date) version of the project in a repository (or repo).

We’re going to look at using the popular GitHub repository, but first we need to install git. Visit Git ( and download the installer for your OS. I’ll be using the build for Windows.

Once the download is complete, run the installer and accept the terms followed by all the default options.

We will also need an account with GitHub, visit GitHub and setup a free account. After you’ve set that up, head back to GitHub and you should see something similar to this…

Make a new repository

Now, we need to create a repository, so click on “New” and that will take you to a page where you can name your repo — generally the same as your project name.

Name your repository

You can then choose your privacy level for this repo. And at the bottom of the page we can setup the repo in a more specific way — not all files created by Unity are necessary to maintain under strict version control so to prevent maintaining more files than required, we can exclude those unnecessary files by creating a .gitignore file specific to Unity.

Configure repository for Unity

NOTE: Once we have synced our local project and our GitHub repo, this file will be stored in the root of your project and can be edited to suit more specific needs.

That’s the repo setup complete, we just need to hit “Create Repository” and once that is finished… Welcome to your new repo!

Repo complete!

So now we need to sync up our repo with our local project (you can either create a new project or use an existing one), but before we do…

There are some issues between the branch naming conventions of Git Bash (the software you just installed at the start) and GitHub (the repository we just set up) but we can nip these in the bud at the start. First, open up your Git Bash — there should be an icon on the Desktop but failing that, can be found in your Windows directory \Program Files\Git\git-bash.exe.

You’ll see a screen similar to the above — this is the command line interface we’ll be using to manage our repository. The next thing to do is to reset the default branch name for Git Bash to match that of GitHub, we can do this with the following configuration command

This configures Git Bash to use the reference “main” as the default branch name and brings it in line with GitHub naming conventions, avoiding issues down the line.

NOTE: There are several ways to resolve this issue but I have found this to be the easiest approach.

Now that we have the essentials set up, we can look at getting started with a new Unity project. We’ll return to how we can use Git with Unity in another article.

Getting setup with Unity and Git — Part 2

A UK based Unity Developer with a passion for gaming and coding

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store