通过服务器终端上传gitlab项目

1. 注册gitlab用户

2. 在服务器端确定好要上传的项目文件夹,在gitlab创建一个同名仓库

3. 将仓库设置为允许force push,位置为settings—repository—protected branches—allowed to force push

4. 初始化

git init

5. 登录gitlab

git config --global user.email "[email protected]"
或
git config --global user.name "Your Name"

6. 添加远程版本库

git remote add origin http://123.321.65.37:2721/hostname/name.git

7. 添加当前目录下的所有文件到暂存区

git add .

8. 提交暂存区到本地仓库中

git commit -v -m 'upload files'
-v:显示本次操作进度
-m:操作描述,显示在gitlab仓库中

9. 确认当前分支

git branch -M main

10. 上传到gitlab并合并

git push -uf origin main

你可能感兴趣的:(gitlab,git)