git
gitlab has three permission levels
- Private Private, only you or members of the group can access
- Internal All logged in users
- Public, accessible to everyone
Private
Private only allows ssh to push code.
ssh-keygen -t rsa -C 'mark'
Generate a pair of public and private keys through . If using the default name~/.ssh
, look for theid_rsa
file under
- Copy the file
id_rsa.pub
to the ssh configuration on git.
If you need to configure multiple git accounts at the same time, you need to ~/ssh
add the following config
file , the content is as follows:
HOST 192.168.1.212
HostName 192.168.1.212
Port 10022
User git
IdentityFile ~\.ssh\test_id #私钥的路径
HOST git.oschina.net
HostName git.oschina.net
IdentityFile ~\.ssh\id_rsa_oschina
PreferredAuthentications publickey
User username2