Day 1: My Introduction To setting up A Git Repository For Unity Step by Step.
Objective: How to set up a git repository.
So you started your journey into Software Development and are told you need to get used to using Git and setting up repositories. The bright eyed optimistic developer you are is excited to begin this journey until you sit down and realize you have to take the first step. It is at this moment you realize how the heck do you start this? That’s where I’m here to help you best I can step by step.
First we are going to assume you signed up for git and already have an account. Then we are going to assume you have downloaded git and git bash and are ready to begin the process. Cool pat yourself on the back the hard part is already over. You won half the battle. Yay! Now the fun can begin.
Step 1: CREATE A NEW REPOSITORY ON GIT
First your going to want to go to your GitHub homepage and click NEW
It should take you to a page that looks like this.
If your working in Unity like I am you can add Unity to your .gitignore file.
You should be greeted to a page that looks like this.
Almost done. You want take a break now, catch your breath. Pat yourself on the back cause you’re doing great. So now that this is all set up and you already have your unity project ready to uploaded to get let’s move on to..
STEP 2: LINKING YOUR UNITY PROJECT
Get Jonathan Fagan’s stories in your inbox
Join Medium for free to get updates from this writer.
Open up your gitBash and navigate to your Unity folder where your project is store. You can use a simple short cut and right click on the folder and use the command open [GitBash Here].
Now once we’re in our GitBash terminal type in the command git init to initialize git inside our fold so we can start using git services and version control.
Next we need to link it to our online repository. So go back to your GitHub and click this <> Code and click the pad to copy the GitHub repo link.
Next we add a way to connect our local git to the online server. Type in the command git remote add (paste the link you just copied)
Phew.. we’re almost done, I promise. Just a couple more things to do.
Next we’re going to PULL — Download and integrate the files on the server to our local project.
Note: If you’re doing this from scratch and using this method you won’t have a working branch and need to create one.
So Use this command git pull origin main. This will pull from the Server. Create a branch and merge everything into a working branch( a branch is a space where you can make specific changes that wont affect all the files on a project) called main.
Step 3: PUTTING IT ALL TOGETHER — THE HOME STRECTH
Time to Add or Stage all of our changes to be ready. It’s like making sure you have everything before you leave the house. For this we’ll use the command [git add .] This will Stage everything and make sure its ready to go
After that we’ll make a commit message to remind ourselves what we did when we committed this. We’ll use the command [git commit -m “message goes here”]
And Lastly we’ll push the changes to the server so everything is saved.
And we’re done.
That was a lot but I hope it helped. Thanks for reading.








