Getting Good at Git-Setting up Git for Unity

Github is a phenomenal resource for version control and it is free to use, making it an obvious choice for a solo or small development team.

Setting up version control via Git for a Unity project is also incredibly easy and intuitive. Today, I will be covering how to set up Git for your own projects moving forward!

First thing is to make a repository on Github.com.

Navigate to your account information and open up your repositories tab. If this is your first project, it will be empty.

At the top right of the screen, press the green “New” button.

Your window will now look like this.

New Repository Window

Name your repository, and give it a description if desired.

I will be keeping this repository public, so others can view or access it.

Finally, add a .gitignore for the appropriate file type. In this case, I am using Unity.

Now press the green “Create Repository” button at the bottom.

Now open the webpage for your repository and find the green “Code” drop down menu in the top right. In the menu, click the copy to clipboard icon.

Now we need to navigate to our local project on our computer. Navigate to the project folder on your PC, right click, and Git Bash here.

A new command line window will open inside this repository.

NOTE: all git commands start with the keyword “git”

First thing is it initialize git for this location. We can do this by typing “git init”.

Now we need to add our remote location to the repository. This can be done using the following:

“git remote add origin” then on the same line, middle click your mouse to paste the repository URL we copied earlier.

Now our local and remote repositories can interface with each other.

The last step is to make our initial commit. This will save any local files to the remote location, where anyone can access them at will.

We do the following commands:

“git add .”

This adds all local changes to be commit.

Next:

git commit -m “initial commit”

NOTE: The area inside the quotations can hold whatever words you want them to.

Finally, we need to push this commit to the remote server by doing the following:

git push origin master (or your branch name here)

NOTE: My repository was already up to date here, so nothing was pushed.

To pull the changes from the remote server to your local project:

git pull origin master

And that’s the basics of using Github for your projects!

--

--

--

I am a software engineer with years of experience branching into game development, specifically in Unity. Follow along for guides on creating game mechanics!

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Automation of Testing and Production via Jenkins

How To Fix The “We Are Unable To Create An Authentication Session” error in Visual Studio

How to fix the we are unable to create an authentication session error when publishing your xamarin project to the appstore

Cool Down System in Unity

📢✨NO TIME TO WASTE — -H-U-R-R-Y NOW!🚀🚀

Participate in periodic on-call duties?! Nope. I’m too old for this crap.

Happy 4th birthday to Binance.com. May the flag continue to fly and be successful. #BinanceTurns4

Free Download Mastering the Requirements Process: Getting Requirements Right (3rd Edition) Pre…

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
Jack Leavey

Jack Leavey

I am a software engineer with years of experience branching into game development, specifically in Unity. Follow along for guides on creating game mechanics!

More from Medium

git it on the page!

Delaying LoadScene while Cinematic Sequence Plays in Unity 2021

Instantiating & Destroying Game Objects in Unity | Shooting Mechanics

Unity fundamentals — Getting a more productive workflow through your layout