How to Git in Unity- part 2
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.
- Open github.com and log in your account, then open the repositories page.
- Press New to create a new repository.
- Name your repo as your project, select Public.
Click Add .gitignore and select( or search) Unity.
- Press create repository.
Then we need to setting at our local files.
- Go to the project folder and right click, choose Git Bash Here.
2. We need to initialize our git first by input:
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.
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.