GitLab系列(三):本地代码上传到gitlab

1、首先下载安装git客户端下载地址:https://git-scm.com/download/win

2、安装,下一步直到完成

3、这时登录gitlab查看已建好的项目,如果还没有项目就建一个对应的项目,添加公钥(如果已添加公钥跳过第4步)

4、(如果已添加公钥跳过此步)没有秘钥推送不了代码,需要先部署秘钥点击

然后执行

1、git config --global user.name "Administrator"

2、git config --global user.email "[email protected]"

3、ssh-keygen -t rsa -C "[email protected]"

在C:\Users\EDZ\.ssh路径下找到秘钥文件,.pub后缀是公钥

将秘钥拷贝粘贴到gitlab

5、上传步骤

git config --global user.name "Administrator"
git config --global user.email "[email protected]"
cd existing_folder
git init
git remote add origin [email protected]:root/baixing1.git
git add .
git commit -m "Initial commit"
git push -u origin master

点git bash打开

cd existing_folder可以打开Git Bash将项目文件直接拖到git客户端在路径前加cd回车

这时客户端显示项目文件的路径

在路径的最前边加上cd然后回车

6、顺序执行以下命令

git config --global user.name "Administrator"

git config --global user.email "[email protected]"

git init

git remote add origin [email protected]:root/baixing1.git

git add .

git commit -m "Initial commit" git push -u origin master

7、上传完成

猜你喜欢

转载自blog.csdn.net/xopqaaa/article/details/88885868