-
First, create a new warehouse on your own gitlab
-
Install git locally and configure the global connection user
git config --global user.name "xxx" git config --global user.email "[email protected]"
-
Divided into four situations for local and remote connections
-
Is an empty new project
# 克隆远端仓库到本地 git clone http://gitlab.xxx/wlq/test1.git # 进入本地仓库 cd test1 # 新建概述文件 touch README.md # 将修改添加到待上传列表 git add README.md # 提交修改到本地仓库 git commit -m "add README" # 上传本地仓库到远端仓库主分支 git push -u origin master
-
There is already a project file locally
# 进入project目录 cd existing_folder # 初始化本地仓库 git init # 将本地仓库和远端空仓库进行关联 git remote add origin http://gitlab.xxx/wlq/test1.git # 添加本地project所有内容到待提交列表 git add . # 提交待提交列表内容到本地仓库 git commit -m "Initial commit" # 将本地仓库同步到远端仓库主分支 git push -u origin master
-
Other remote warehouses have content
# 进入已经存在的资料库 cd existing_repo # 重命名旧的仓库连接 git remote rename origin old-origin # 添加新的仓库连接 git remote add origin http://gitlab.xxx/wlq/test1.git # 将资料提交到新的仓库 git push -u origin --all # 提交标签 git push -u origin --tags
-
Sync remote warehouse to local
# 克隆远端仓库到本地 gitclone http://gitlab.xxx/wlq/test1.git # 进入本地仓库 cd test1
-
Code manager for interview questions (take gitlab as an example, gitlab starts to manage the basic operations and commands of new projects)
Guess you like
Origin blog.csdn.net/qq_42546127/article/details/114985363
Recommended
Ranking