zoukankan      html  css  js  c++  java
  • macOS配置GitHub和GitLab共存

    1. 查看之前是否设置过全局的user.nameuser.email:

    git config --global --list

    1. 如果已设置,则删除

    git config --global --unset user.name "你的名字"
    git config --global --unset user.email "你的邮箱"

    1. 生成SSH Key:

    ssh-keygen -t rsa -f ~/.ssh/id_rsa.github -C "abc@qq.com"
    ssh-keygen -t rsa -f ~/.ssh/id_rsa.gitlab -C "abcdef@qq.com"

    1. 获取公钥粘贴到对应平台:

    cat id_rsa.github.pub
    cat id_rsa.gitlab.pub

    1. 配置config:

    cd ~/.ssh && touch config
    vim config

    # github
    Host github.com
    HostName github.com
    User GaiheiluKamei
    IdentityFile ~/.ssh/id_rsa.github
    
    # gitlab
    Host gitlab.google.com  ## 公司提供的网址
    HostName gitlab.google.com ## 同上
    User git
    IdentityFile ~/.ssh/id_rsa.gitlab
    Port 2223  ## 公司提供的端口
    
    1. 验证是否正确:

    ssh -T git@github.com
    ssh -T gitlab.google.com

    git commit 提示:

    *** Please tell me who you are.
    Run
    
    git config --global user.email "you@example.com"
    git config --global user.name "Your Name"
    
    to set your account's default identity.
    Omit --global to set the identity only in this repository.
    

    执行:
    git config user.email "abc@qq.com“
    git config user.name "abc“

  • 相关阅读:
    ElasticSearch搜索
    Muddery框架
    https和http的区别
    multiprocessing模块创建进程
    进程理论基础
    单例模式
    原型模式
    建造者模式
    StrutsTypeConverter的使用
    UML用例图之泛化(generalization)、扩展(extend)和包含(include)关系--UML一波流系列讲解
  • 原文地址:https://www.cnblogs.com/GaiHeiluKamei/p/13802458.html
Copyright © 2011-2022 走看看