-
远程新建一个仓库
远程仓库地址如:gitee.com/xxxx/demo
-
本地新建Java Maven or Gradle 工程
-
本地工程关联远程仓库
a. git remote add origin 远程仓库地址, 如:git remote add origin gitee.com/xxxx/demo;
b. git pull origin master --allow-unrelated-histories;
c. git branch --set-upstream-to=origin/master master ;
d. git push .
-
常见问题
a. branch 'origin/master' does not exist : 未执行第三步b操作(3-b);
b. Can't update master has no tracked branch Choose upstream branch : 同上。
c. 当执行git中的
git pull origin master –allow-unrelated-histories命令时, 如果出现fatal: couldn't find remote ref –-allow-unrelated-histories的错误,输入如下命令即可解决:
1) git pull --rebase origin master
2) git push origin master