美文网首页
MAC git同时配置gitlab&github

MAC git同时配置gitlab&github

作者: Yobhel | 来源:发表于2024-02-26 10:31 被阅读0次

一、生成 ssh

mkdir ~/.ssh 
ssh-keygen -t rsa -C "youremail@xxx.com(gitlab使用的邮箱)" -f ~/.ssh/id_rsa_gitlab 
ssh-keygen -t rsa -C "youremail@xxx.com(github使用的邮箱)" -f ~/.ssh/id_rsa_github

二、链接gitlab

cd ~/.ssh
image.png
cat id_rsa_gitlab.pub
复制全部内容
image.png

将public key粘贴到gitlab下图位置,并保存

image.png image.png

三、链接github

cd ~/.ssh
image.png
cat id_rsa_github.pub
复制全部内容
image.png

将public key粘贴到github下图位置,并保存

image.png
image.png

四、管理ssh keys

ssh-add ~/.ssh/id_rsa_github
ssh-add ~/.ssh/id_rsa_gitlab
touch ~/.ssh/config
vi ~/.ssh/config
#粘贴到 ~/.ssh/config
Host github.com
   HostName github.com 
   User **** #写gitthub使用的邮箱  
   IdentityFile ~/.ssh/id_rsa_github #这里是Github生成sshkey的那个文件路径
 
Host gitlab #如果地址是公司的地址的话就直接写成公司的ip
   HostName gitlab #如果地址是公司的地址的话就直接写成公司的ip
   User **** #写gitlab使用的邮箱
   IdentityFile ~/.ssh/id_rsa_gitlab #这里是GitLab生成sshkey的那个文件路径

五、结果&测试连接

ssh -T git@github.com
ssh -T git@gitlab.com
image.png

相关文章

  • Git 入门

    Git 下载 windows下载地址 mac下载地址 Git 配置 配置基本信息 这些配置都是在写 ~/.git...

  • Mac 上配置多个git账号

    参考 1、mac 下使用多个 git 账户配置2、Mac多个Git账户配置3、如何在一台电脑上使用多个git帐号 ...

  • Git 安装

    安装git mac安装git 配置Git 配置Git的用户名跟邮箱, 下面的命令 表示配置home目录下的设置 配...

  • Git常用命令总结

    git config   git config命令的作用是配置git的相关信息。 配置全局的用户名和邮箱,mac下...

  • mac下搭建git服务器学习总结

    重要:开头列出参考来源,感谢原作者的无私奉献 Mac 下配置 Git 服务器、Mac 下配置Git 服务器- 罗朝...

  • git基本命令

    git config git config命令的作用是配置git的相关信息。 配置全局的用户名和邮箱,mac下可通...

  • Git教程笔记

    Git教程笔记 Git教程-菜鸟教程 1. Git 安装配置 1.1 Linux | Windows | Mac...

  • Mac github的本地配置

    安装git 配置用户名和邮件 配置秘钥 done! 参考: MAC上Git安装与GitHub基本使用

  • mac 配置git 冲突合并工具 kdiff3

    mac 配置git 代码合并工具 kdiff3 git config --global merge.confl...

  • Git 常用命令大全

    Git库创建 Git配置 以MAC系统,Git配置文件一般有两个配置文件,其作用域分别为全局级、仓库级 全局级配置...

网友评论

      本文标题:MAC git同时配置gitlab&github

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