Theme NexT works best with JavaScript enabled
0%

How to use gitlab

^ _ ^

Step1: 安装git

1
2
# 测试安装是否成功
git config --list

Step2: 按照gitlab上填写的信息进行git配置

1
2
git config --global user.name Llunch4w
git config --global user.email 1220296312@qq.com

Step3: 生成公钥上传

1
2
3
4
5
# mac
ssh-keygen -t rsa -C 1220296312@qq.com -f ~/.ssh/id_rsa_gitlab

# windows
ssh-keygen -t rsa -C 1220296312@qq.com -f C:\Users\<用户名>\.ssh/id_rsa_gitlab

测试是否能正常连接

1
ssh -T git@hit_gitlab

创建项目并git

前提, 在gitlab上New一个同名项目.

场景一: 将已有项目上传

1
2
3
4
5
6
cd existing_folder
git init
git remote add origin ssh://git@hit_gitlab/LuckyQ/test.git
git add .
git commit -m "Initial commit"
git push -u origin master

场景二: 将gitlab上的项目clone下来

1
2
3
4
5
6
git clone ssh://git@10.249.41.144:30001/LuckyQ/test.git
cd test
touch README.md
git add README.md
git commit -m "add README"
git push -u origin master