java多线程    Java入门    vsftp    ftp    linux配置    centos    FRP教程    HBase    Html5缓存    webp    zabbix    分布式    neo4j图数据库    

一台机器多账户多域名配置git

配置用户名
公共配置:对所有项目生效

$ git config --global user.name "Your Name"
$ git config --global user.email "email@example.com"

单独配置:对当前项目生效

$ git config user.name "Your Name"
$ git config user.email "email@example.com"
#cd /Users/ge/.ssh

#touch config

#vi config

config内容如下

# 该文件用于配置私钥对应的服务器
# Default github user(first@mail.com)
Host github.com
 HostName github.com
 User yuexiaosheng##163.com
 IdentityFile /Users/ge/.ssh/github

 # second user(second@mail.com)
 # 建一个github别名,新建的帐号使用这个别名做克隆和更新
Host git.mycompany.cn
 HostName git.mycompany.cn
 User tom
 IdentityFile /Users/ge/.ssh/id_rsa
ssh-keygen -t rsa -C "yuexiaosheng##163.com"

第一步输入的时候,要求输入一个名字的时候,起名为github即可

这样在下载github的内容,自动定位用/Users/ge/.ssh/github,

下载mycompany.cn的内容,自动定位用/Users/ge/.ssh/id_rsa

一个机器就可以用两份git的资料的。


This entry was posted in Linux, MAC and tagged . Bookmark the permalink.
月小升QQ 2651044202, 技术交流QQ群 178491360
首发地址:月小升博客https://java-er.com/blog/more-account-git/
无特殊说明,文章均为月小升原创,欢迎转载,转载请注明本文地址,谢谢
您的评论是我写作的动力.

Leave a Reply