Git-Unity项目版本管理

本文记录如何用git对unity 项目进行版本管理,并可传至GitHub远端。

准备

名称版本
windows11
Unity2202.3.9.f1
gitN.A.
githubN.A.

GitHub新建项目并添加ssh密钥

  1. GitHub新建一个repository
  2. 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/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值