git初次提交本地代码到远程GitLab仓库分支

1.配置本地映射

C盘 window-system32-drivers-etc-host (127.0.0.1   xxxxx.com)

2.进入本地仓库,在要提交的代码目录右键 git bash here

#如果之前有初始化 init 需要删除

命令: rm -rf .git

#初始化本地仓库

命令: git init

#连接远程git仓库

命令: git remote add origin http://gitxxxxx.git

#创建并切到分支
git checkout -b 分支

#添加本地需要提交的代码(.表示所有)
git add .

#提交代码并添加说明
git commit -m “first commit”

#上传代码代码到分支
git push origin 分支

原文地址:https://www.cnblogs.com/tubashu/p/11713417.html