免费下载网站设计方案学校网站设计首页
目录
- 准备
 - GitHub新建项目并添加ssh密钥
 - Unity文件夹
 
本文记录如何用git对unity 项目进行版本管理,并可传至GitHub远端。
准备
| 名称 | 版本 | 
|---|---|
| windows | 11 | 
| Unity | 2202.3.9.f1 | 
| git | N.A. | 
| github | N.A. | 
GitHub新建项目并添加ssh密钥
- GitHub新建一个repository
 - windows11 生成ssh-key(可选)
 
ssh-keygen -t rsa
cd ~/.ssh
dir
cat id_rsa.pub
 

 3. 复制 id_rsa.pub 内容至 repository 的 Setting 下的 Deploy keys 处
 
Unity文件夹
为Unity project文件夹配置git
git init
添加 .gitignore (此步为重点,可避免上传冗余文件:可直接从此处下载放在文件夹里即可 https://github.com/github/gitignore/blob/main/Unity.gitignore)
添加 .gitattributes (此步为重点,可直接从此处下载放在文件夹里即可 https://github.com/gitattributes/gitattributes/blob/master/Unity.gitattributes)
git add .
git commit -m "自定义备注"
git status git remote add origin <git@github.com:xxx/xxx.git>
git push -u origin master #上传至branch: master,可根据需要换至其他branch
git status
git log
 

参考:
 https://unityatscale.com/unity-version-control-guide/how-to-setup-unity-project-on-github/
