How to Git in Unity- part 2

S.J. Jason Liu
3 min readApr 22, 2021

If you haven’t set the Git yet, you can read the previous article at Here:
How to Git in Unity- part 1

Now we will jump through the Unity project setting section, assume that the project is already exist for doing version control.

First, we need to add repository on github.com.

  1. Open github.com and log in your account, then open the repositories page.
  2. Press New to create a new repository.
  1. Name your repo as your project, select Public.
    Click Add .gitignore and select( or search) Unity.
  2. Press create repository.

Then we need to setting at our local files.

  1. Go to the project folder and right click, choose Git Bash Here.

2. We need to initialize our git first by input:
git init

However, this might cause some issue with namespace due to the difference of default setting from Git Bash(master) to Github(main).
My way to solve this issue is to create another branch name “main”, and delete “master” at local after push all the updates.
This part will update in the next article.

3. Then we need to add a remote to our repository that we just created on Github.com.
Go to your repo page and click the Code button, then copy the link.

Copy this

Back to Git Bash, input:
git remote add origin <paste your link>

You can input:
git remote -v
to verification. Then you should see 2 link, one with fetch and one with push.

4. Now we can start to push updates and commit.

Next: How to Git in Unity- part 3

--

--

S.J. Jason Liu

A passionate gamer whose goal is to work in video game development.