Creating a GitHub repository and connecting it to a Unity Project!

Alright, you got Git Bash installed on your system, you have a Unity project ready to go. Now what? Now it’s time to use Git Bash and connect it to your project and create your first branch!

We’re going to start by creating a new Unity Project (or you can use an active project) that we’d like to connect to GitHub.

Next we’ll login to GitHub and create the repository we’ll be using for this new Unity Project.

When creating the repository, I like to keep the name the same as my Unity project (or at least very similar), to avoid as much confusion as possible. You can choose whether the repo will be public or private, completely up to how you want to share it.

IMPORTANT: When creating a repo for Unity, make sure to include a “.gitignore” file, and choose the Unity Template. There is a lot of information that doesn’t NEED to be on GitHub, and will end up jumbling your Git creating some chaos. The .gitignore easily solves this problem.

Voila! Your first GitHub repository has been created! It’s not doing much for the time being, so now we have to hook it up with our Unity project.

Open up Git Bash from your main directory folder of your Unity Project:

Luckily, setting up Git Bash to interact with GitHub is no circus act and can be completed in a few simple steps!

First: we have to initialize Git inside of the directory by typing “git init”.

Remember, when writing Git commands, every command is preceded by “git”.

Second: we’ll go back to GitHub and copy the HTTPS of our repository page:

This is what GitBash looks for when pushing to the server. It’s essential you copy and paste it with no errors!

Third: we create the remote server link, give it a name, and paste the HTTPS that relates to this new server. This is done by typing git remote add origin …

To Note:

Now if all went well, you should be connected! You can verify this by typing “git remote -v”.

Next up, we’ll be making our first pull, commit, and push!

Audio Engineer turned Unity Game Dev. Will be combining both my skillsets when appropriate, and will be documenting my Unity Dev growth in these Medium Articles

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