zoukankan      html  css  js  c++  java
  • 一台电脑使用多个git账号

    最近开始使用git,今天又新建了一个github账号,提交是发现总是说第一个账号没有权限,后发现git push的时候需要区分github账号,现记录解决方案:

    1.创建SSH KEY  $ ssh-keygen -t rsa -C "your_email@example.com",根据提示输入文件名,如id_rsa_two,粘贴复制到github的SSH

    2.查看用户~/.ssh下是否存在 config文件,如不存在使用命令 touch config创建,然后配置config

    #github server one
    Host github
    Hostname github.com
    User git
    IdentityFile ~/.ssh/id_rsa
    #github server two
    Host github_two
    Hostname github.com
    User git
    IdentityFile ~/.ssh/id_rsa_two

    3.测试配置,测试成功后github ssh处小钥匙图标会变绿色

       ssh -T git@gihub_two   

       #如果配置正确会提示

       Hi your git account two in github ! You've successfully authenticated, but GitHub does not provide shell access.

    4.clone项目到本地

    原先操作:  git clone git@github.com:yourAccount/xxx.git;

    现改为:git clone git@github_two.com:yourAccount/xxx.git 

    学无先后,达者为师
  • 相关阅读:
    how to pass a Javabean to server In Model2 architecture.
    What is the Web Appliation Archive, abbreviation is "WAR"
    Understaning Javascript OO
    Genetic Fraud
    poj 3211 Washing Clothes
    poj 2385 Apple Catching
    Magic Star
    关于memset的用法几点
    c++ 函数
    zoj 2972 Hurdles of 110m
  • 原文地址:https://www.cnblogs.com/seanchang/p/9737446.html
Copyright © 2011-2022 走看看