美文网首页
git + gitlab + github的关联

git + gitlab + github的关联

作者: 贺贺v5 | 来源:发表于2023-06-07 19:46 被阅读0次

当新拿到一台Mac后,需要重新配置好多环境,今天就来记录一下如何配置git+gitlab(公司自己的私有仓库)+github的环境,使得git clone git@gitlab.100credit.cn:bairong/rule-config.git可是正常下载。

  1. 配置git环境
  1. 生成公钥和私钥
  • ssh-keygen -t rsa -C "hehe.he@100xxx.com"

    这样就表示成功生成了私钥(.ssh/id_rsa)和公钥(.ssh/id_rsa)。
  1. 将公钥拷贝到gitlab和github的SSH keys中


    image.png
  1. 将私钥配进/Users/hehe/.ssh/config文件中
Host gitlab.100credit.cn
HostName gitlab.100credit.cn
Port 3222
User heyingchun
IdentityFile ~/.ssh/id_rsa

如果总是报错:Bad owner or permissions on /Users/hehe/.ssh/config
那么在.ssh目录下这样执行一下:sudo chmod 600 config

相关文章

网友评论

      本文标题:git + gitlab + github的关联

      本文链接:https://www.haomeiwen.com/subject/mmmnedtx.html