赞
踩
git config --global user.name "Administrator"
git config --global user.email "admin@example.com"
cd existing_folder
git init --initial-branch=main
git remote add origin http://192.168.2.210/root/mytest.git
git add .
git commit -m "Initial commit"
git push -u origin main
Start directory
路径为:本地下载Git的bin目录,这里是D:\Git\bin
shell path
路径为D:\Git\bin\sh.exe
.py
文件,随便写点东西,接下来我们就把这个.py
文件上传到gitlab上 test.py
所在目录,这里在D:/PycharmProjects/mytest/venv/
目录下cd D:/PycharmProjects/mytest/venv/
然后运行gitlab上提示的命令
git config --global user.name "Administrator" # Administrator 可以自定义编辑
git config --global user.email "admin@example.com" # admin@example.com 自定义
git init --initial-branch=main
git remote add origin http://192.168.2.210/root/test.git
git add .
git commit -m "Initial commit" # Initial commit 可以替换成任意东西
git push -u origin main
在终端执行完命令后,到gitlab上检查,就出现了test.py的文件,表示上传成功。
如果要修改了test.py
的文件内容,将hello改为了hello1,要把改后的test.py
推到gitlab上。需要先从gitlab上拉取最新的文件,修改后,在推到gitlab。流程图如下:
也就是说,执行如下命令
# 先拉取
git pull origin
#再推送
git add .
git commit -m "Initial commit" # Initial commit 可以替换成任意东西
git push -u origin main
git pull orgin 后直接修改test.py文件,将hello改为了hello1。
main
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。