【Git】GitLab网页管理方法

    xiaoxiao2021-04-16  54

    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 key pair了,将公钥复制到gitlab即可 b、生成ssh key pair Windows:使用PuttyGen生成ssh key pair GNU/Linux / macOS: ssh-keygen -t rsa -C "GitLab" -b 4096 建议使用默认位置生成ssh key pair,否则需要修改.ssh/config文件 不建议跳过密码 c、将公钥复制到gitlab macOS: pbcopy < ~/.ssh/id_rsa.pub GNU/Linux (requires the xclip package): 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
    转载请注明原文地址: https://ju.6miu.com/read-673064.html

    最新回复(0)