Using GitHub For Your Unity Projects

Rehtse Studio
5 min readMay 3, 2022

Lets us save our precious Unity Projects in our GitHub account using Git

This article thinks that you have already a Unity project on your drive. If you don’t have a Unity project create one to have it store on your GitHub account

What We Need

Download Git

Locate the git file, double click to run the program or right click and select open and follow the installation instructions.

Sign Up To Get A GitHub Account

Create Your Repository

Inside your GitHub account, go to the section Repository and click on New

Fill out the following fields

Write the Repository Name and if your like a small Description that is optional

The name on the repository dose not need to be the same as the one from your Unity Project. It is advice that both your repository and your Unity Project share the same name

Select Public.

A Public repository can be share by just sending the link; the Private repository can only be access if the owner gives permission to the user on the security section found in the setting of the Repository

In the Add .gitignore section press on the .gitignore template and select Unity

Now Create Repository

Got to the Code window(Green Square with Code writing on it) and copy your git repository URL address

Initiate Git In Your Unity Project That Will Be Store On Git Hub

Find your desire Unity project, mine is located on the Desktop and is called Unity_VR. Open the Unity project folder, right click in a empty space inside the folder and select Git Bash Here

Git will open directly to the root of your Unity project.

Inside the Git Terminal type git init . and press Enter; and yes there is a space between init and the period(.) You would know that git has been initialize when you see a new folder called .git.

Linking Github to Local Project

Once your project is initialize type on the Git Terminal “git remote add origin #gitURL#”, press enter.

Remember that the #gitURL# is the git repository URL address we copy on the Create Repository section

To see if is running correctly type on the terminal git remote -v . You need to have (fetch) and (push) like you see on the image.

Before uploading our project to GitHub we must first make a PULL to get our .gitignore file into our Unity project. On the terminal type git pull origin master, press enter. You will see the file .gitignore is added to your project.

git add . And Our First Commit

To add our files to GitHub we first must add our files to git. Back to the terminal type git add . , press Enter. Lots of line will appear and depending on the size of your project this can take time.

Now let make your first commit, type git commit -m “write your message between the quotation marks”, press Enter. This can also take some time.

Push Our Project To GitHub

Type git push -u origin master and press Enter to upload your project to GitHub

Refresh your GitHub Repository and you will see your Unity Project uploaded on the repository

This is a fast guide to link your Unity project to a repository on GitHub.

To make a fast note my repository initial branch will always be named Master, your can be named Main; everything on this article will work the same, just change to main when you see the master keyword.

Will add my personal Git Basic Commands Cheat Sheets

TO BE CONTIUNUED😎

--

--

Rehtse Studio

Game Developer sharing content around Unity, programing and tips and tricks in game dev.