Set up Unity Project with git

本文最后更新于 2023年8月22日 下午

1. Install Unity

use 2022 LTS version, 3D

2. Configure Git

2.1 Install Git

If you haven’t already, install Git on your system. Visit the official Git website and follow the installation instructions based on your operating system.

we could use git-lfs to manage large binary file, so install it

2.2 Initialize Git Repository

Open the terminal or command prompt in the root directory of your Unity project. To do this, navigate to the project’s root directory.

2.3 Initialize Git

Run the following command to initialize a Git repository for your project:

1
2
git init
git lfs install

This will create a new Git repository in your project’s directory.

2.4 Set Git User Name and Email

Configure your Git username and email address by running the following commands:

1
2
git config user.name "Your Name"
git config user.email "your@email.com"

Replace “Your Name” with your desired username and “your@email.com“ with your actual email address.

3. Connect to a Remote Git Repository

To collaborate with others and store your project on a remote Git repository (such as GitHub), you need to connect your local repository to the remote repository.

3.2 Add Remote Repository

Run the following command to add the remote repository as the origin:

1
git remote add origin <project_link>

3.3 tracking remote repo

1
2
git fetch origin
git checkout -f -b main origin/main

``

``


Set up Unity Project with git
https://bainianlaoyao.github.io/2023/07/13/typecho-recovered-63-Set-up-Unity-Project-with-git/
作者
百年老妖
发布于
2023年7月13日
许可协议