首页 > 其他分享 >初始化gitlab仓库

初始化gitlab仓库

时间:2022-09-19 18:55:37浏览次数:77  
标签:origin 初始化 git 仓库 gitlab -- add push

初始化gitlab仓库
一、Git全局设置

git config --global user.name "your gitlab username"
git config --global user.email "your gitlab user password"

  

二、创建一个新代码库

git clone ssh://[email protected]
cd yourrepositoryname
touch README.md
git add README.md
git commit -m "add README"
git push -u origin master

  

三、将本地已有项目提交至gitlab

cd existing_folder
git init
git remote add origin ssh://[email protected]
git add .
git commit -m "Initial commit"
git push -u origin master

  

四、本地项目已存在的git 仓库提交至新的仓库

cd existing_repo
git remote rename origin old-origin
git remote add origin ssh://[email protected]
git push -u origin --all
git push -u origin --tags

  

部分错误处理
在第三种方式下,使用 git push -u origin master 时出现 error: src refspec master does not match any.的解决办法是将此命令替换为git push --set-upstream origin main
————————————————
版权声明:本文为CSDN博主「wangjili-...」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/htmlxiaobai/article/details/114523364

标签:origin,初始化,git,仓库,gitlab,--,add,push
From: https://www.cnblogs.com/shiding/p/16708684.html

相关文章