【Git】GitLab网页管理方法

来源:互联网 发布:英制螺纹程序怎么编程 编辑:程序博客网 时间:2024/05/21 17:41
1、用浏览器打开gitlab,登陆

2、创建工程,Namespace表示工程所属,与后面生成的工程url息息相关,权限分为3中,private表示仅namespace组内可用
internal表示所有登陆用户可用,public表示所有人可以访问。

3、项目设置,可以设置用户权限,新增用户到项目等等

4、添加sshkey
git仓库之间的代码传输协议主要使用ssh协议,对于没有密码的git用户,ssh不能直接登陆,这就需要ssh-keygen上传公钥,同时,即便是有密码的用户,上传公钥也可以减少操作步骤,无需输入密码。
若不使用公钥,则每次都要配置密码:
$ git config --global user.name"test"
$ git config --global user.email"test@gmail.com"

a、查找是否已存在ssh key pair
具体生成方法可以参考xxx.xxx.xxx.xxx/help/ssh/README
查看是否已存在ssh key pair
windows:type%userprofile%\.ssh\id_rsa.pub
GNU/Linux / macOS / PowerShell: cat~/.ssh/id_rsa.pub
若返回带有ssh-rsa的字符串,表示已经有ssh keypair了,将公钥复制到gitlab即可
b、生成ssh key pair
Windows:使用PuttyGen生成ssh keypair
GNU/Linux / macOS: ssh-keygen -t rsa-C "GitLab" -b 4096
建议使用默认位置生成ssh keypair,否则需要修改.ssh/config文件
不建议跳过密码
c、将公钥复制到gitlab
macOS: pbcopy <~/.ssh/id_rsa.pub
GNU/Linux (requires the xclippackage): xclip -sel clip < ~/.ssh/id_rsa.pub
Windows Command Line: type%userprofile%\.ssh\id_rsa.pub | clip
Windows PowerShell: cat~/.ssh/id_rsa.pub | clip
当然,各种记事本也可以打开复制。
d、修改ssh keyname密码
ssh-keygen -p
e、非默认地址的ssh配置
# GitLab.com server
Host gitlab.com
RSAAuthentication yes
IdentityFile~/.ssh/config/private-key-filename-01
# Private GitLab server
Host gitlab.company.com
RSAAuthentication yes
IdentityFile~/.ssh/config/private-key-filename
windows下还可以使用GitBash工具来生成
cd ~/.ssh/   #若不存在可手动创建
ssh-keygen -t rsa -C"your_email@example.com"
ssh-add 文件名  #添加密钥到ssh
添加公钥到gitlab
0 0
原创粉丝点击