GitLab 基本使用说明
设置 SSH
- 登录GitLab系统
- 获取ssh公秘钥对,输入命令:
ssh-keygen -t rsa -C “YOUR EMAIL
ADDRESS”, YOUR EMAIL ADDRESS 是你的邮箱地址 - 登陆你的 GitLab 账号之后,点击右上角的”Profile Setting” -> “SSH Keys”,输入
SSH Key 标题(可自定义),将拷贝的 id_rsa.pub 内容拷贝到 Key 中,”Add Key”即可。
创建项目、上传内容
- 在GitLab上点击创建项目,项目名:test
- 命令行中,使用如下命令
- mkdir test
- cd test
- git init
- echo “# Hello” > readme.md
- git add readme.md
- git commit -m “first commit”
- git remote add origin git@172.21.14.125:test/test.git
- git push -u origin master
分支的查看、创建、选择、删除
- 查看
git branch | git branch -a - 创建
git branch newbranch - 选择
git checkout newbranch - 删除
- 本地删除
git branch -d newbranch - 远程删除
git branch origin –delete newbranch
- 本地删除