同时使用多个Git账号

Git比较详细介绍(简书文章)


使用git需要创建sshkey. 否则无法完成对远程仓库的clone push等操作.
sshkey目录在 ~/.ssh

step1: 创建新的 sshkey

终端输入

ssh-keygen -t rsa -C 'Email@mail.com' -f ~/.ssh/id_rsa_oschina

step2 : 创建配置文件 config

vi ~/.ssh/config

内容 :

Host git.oschina.net    #git.oschina.net  
    HostName git.oschina.net   
    User git      
    IdentityFile ~/.ssh/id_rsa_osc   
  
Host github.com   #github.com  
    HostName        github.com  
    User            git  
    IdentityFile   ~/.ssh/id_rsa  
      

step3: 连接本地和git远程仓库

ssh -T git@XXXXX.com 

step4: 连接本地仓库master和远程master分支

此时就已经和远程仓库联系上了. 但当时出了这样一个问题.
pathspec master did not match any file(s) known to git
原来本地的maste分支还不能和远程的master分支建立追踪关系
Git使用之(pathspec master did not match any file(s) known to git)

 git branch -u origin/master master

参考资料:

http://www.cnblogs.com/BenWong/p/4268029.html
http://blog.csdn.net/wj2030/article/details/46763477?ref=myread
Git使用之(pathspec master did not match any file(s) known to git)

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • 1. 安装 Github 查看是否安装git: $ git config --global user.name "...
    Albert_Sun阅读 13,867评论 9 163
  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 136,746评论 19 139
  • 声明:这篇文章来源于廖雪峰老师的官方网站,我仅仅是作为学习之用 Git简介 Git是什么? Git是目前世界上最先...
    横渡阅读 4,158评论 3 27
  • 新发布的文章,好久都没人气怎么办?当然可以找亲朋好友帮你攒人气。 但笔者刚发现了一个更简单粗暴的方法: ✔发布文章...
    解小马阅读 831评论 2 1
  • 他总是喜欢面朝南方坐着,因为,他怕冷,怕孤独。 —题记 我第一次见到他是...
    舞笙文w阅读 400评论 4 2

友情链接更多精彩内容