[gitlab] Upload local code to gitlab

Right click on the local project

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

 Error in the last step:

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

Go to gitlab to modify the account permission developer permission for uploading code as shown below

Because:

English

 Chinese

 Can be modified Developers can push

Guess you like

Origin blog.csdn.net/legend818/article/details/130035485