**
亲测可用~
**
1、在github创建一个repository,起个name,写个description,建个MIT license
2、在本地的代码写好,比如你多个项目都放在了UnityProject文件夹下,其中一个项目叫做Game1,另外一个项目叫做Game2
3、记住,是在UnityProject文件下右键GitBash Here
4、git init 创建仓库
5、cd Game1 进入Game1项目
6、git add . 添加所有文件和文件夹
注意:如果有不想要添加的文件,就创建一个.gitignore文件(在项目路径下),然后写上屏蔽文件的路径就行了
7、git commit -m "这次提交的注释,你自定就行"
这个命令带来的效果在github上可以看到
8、git remote add origin git@github.com:Keneyr/LearnUnity3D.git
注意:填你自己的github仓库的git就行
9、git push -u origin master
注意:在这里一般github会判断你提交的东西和远程的仓库是否有关联,如果它觉得没关联,就会拒绝你提交,这时你可以执行10
10、git pull origin master --allow-unrelated-histories
退出编辑状态:wq
11、重新git push origin master
观察github上的仓库情况,新项目传上去了:
刚开始的时候我不知道这些个命令,直接在项目文件夹下创建git,导致是项目下的许多个文件传到了远程仓库,那么如何删除的呢?
1、删除本地的.git文件
2、删除远程的仓库
对,就是这么绝情,直接删仓库,重新建立仓库,期间需要填密码
都已经忘记github密码了,全靠浏览器帮我记着,微笑。
记忆小贴士:
push是推到远程服务器上
pull从从远程服务器上拉到本地
二更:
后来发现上传的gif打不开,这样更改:
C:\Windows\System32\drivers\etc
在hosts文件后面加上:
```bash
0.0.0.0 account.jetbrains.com
# GitHub Start
192.30.253.112 github.com
192.30.253.119 gist.github.com
151.101.184.133 assets-cdn.github.com
151.101.184.133 raw.githubusercontent.com
151.101.184.133 gist.githubusercontent.com
151.101.184.133 cloud.githubusercontent.com
151.101.184.133 camo.githubusercontent.com
151.101.184.133 avatars0.githubusercontent.com
151.101.184.133 avatars1.githubusercontent.com
151.101.184.133 avatars2.githubusercontent.com
151.101.184.133 avatars3.githubusercontent.com
151.101.184.133 avatars4.githubusercontent.com
151.101.184.133 avatars5.githubusercontent.com
151.101.184.133 avatars6.githubusercontent.com
151.101.184.133 avatars7.githubusercontent.com
151.101.184.133 avatars8.githubusercontent.com
# GitHub End
怎么说,至少出图了