sort | title |
---|---|
6 |
Gitlab |
There is a *self-hosted* **Gitlab** instance at **Gravity**: [https://git.gravity.sjtu.edu.cn](https://git.gravity.sjtu.edu.cn)
Open Gitlab on browser, there are two ways to login:
Like Github, you can use SSH to access Gitlab. But you need to add your SSH key to Gitlab first.
Generate SSH key:
ssh-keygen -t rsa -b 4096 -C "$NAME@Gravity-Gitlab" -f /home/$NAME/.ssh/id_rsa_gitlab -q -N ""
You will generate two files: ~/.ssh/id_rsa_gitlab, ~/.ssh/id_rsa_gitlab.pub
. Copy your public key content to Gitlab:
~> cat ~/.ssh/id_rsa_gitlab.pub
# Output 👇
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCcjFKepF608tQHKbrBJWSrUapb/cqFqJUNbCpqQT5UTzCY2j5CjlpNdxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxg3eHlDAVaM5nlP2Rk+z+7CG0lzcpH7BERKIQ== lalala@Gravity-Gitlab
Click account preferences on top right corner, then click SSH Keys on left sidebar, paste your public key to Key field, and click Add key button:
Last step, we need to configure SSH to use this key. Add following content to ~/.ssh/config
:
Host git.gravity.sjtu.edu.cn
HostName git.gravity.sjtu.edu.cn
Port 33
IdentityFile ~/.ssh/id_rsa_gitlab
Let us try to access Gitlab now:
~> ssh -T git@git.gravity.sjtu.edu.cn
# Output 👇
Welcome to GitLab, @lalala!