上传本地项目到GitLab

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/u010473656/article/details/78321030

将本地项目上传到GitLab:

git init
git add .
git remote add origin git@gitlab.xxxx.com:loangroup/xxxx.git

报错:fatal: remote origin already exists. 删除远程已经存在的origin:

git remote rm origin 

然后继续:

git remote add origin git@gitlab.xxxx.com:loangroup/xxxx.git

将代码push:

git push

又报错,不过有提示信息:
fatal: The current branch master has no upstream branch.
To push the current branch and set the remote as upstream, use

git push --set-upstream origin master


按照提示信息输入命令:

git branch --set-upstream-to master origin/master

报错:fatal: branch ‘origin/master’ does not exist

先提交本地代码到本地仓库:

git commit -m "commit"  

提交代码到远程仓库:

 git push --set-upstream origin master

要求输入密码:[email protected]’s password:

终于到最后了,编辑当前项目.git/config 文件,将

url=git@gitlab.xxx.com/loangroup/ml-sso.git 

改成:

 url = http://gitlab.xxx.com:8081/loangroup/xxx.git

最后再执行下下面的命令就可以了:

 git push --set-upstream origin master

猜你喜欢

转载自blog.csdn.net/u010473656/article/details/78321030