【gitlab】上传本地代码到gitlab

在本地项目右击

git init

git add .

git commit -m "注释"

git remote add origin 地址

# 修改分支master为main
git branch -m master main

#  这个关键,因为之前在gitlab创建仓库有默认文件
git pull  origin main --allow-unrelated-histories

# git push origin main

 最后一步报错:

GitLab: You are not allowed to push code to protected branches on this project.

去gitlab修改上传代码的账户权限developer权限为下图

原因是:

英文

 中文

扫描二维码关注公众号,回复: 14983996 查看本文章

 可以修改开发者可以推送

猜你喜欢

转载自blog.csdn.net/legend818/article/details/130035485