当前位置:   article > 正文

git多账户冲突问题_no argument after keyword

no argument after keyword

ssh-keygen -t rsa -C "邮箱" 生成GitHub密钥

在输入完命令之后 当看到

Enter file in which to save the key (/c/Users/aaa/.ssh/id_rsa): 的时候 在这里输入你的公钥“别名”

 

git config user.name “用户名”

git config user.email "邮箱"

不能加global

 

最最关键的一步

配置config文件

在.ssh文件下手动新建config文件

每个账号单独配置一个Host,每个Host要取一个别名,每个Host主要配置HostName和IdentityFile两个属性即可

Host的名字可以取为自己喜欢的名字,不过这个会影响git相关命令,例如:

Host mygithub 这样定义的话,命令如下,即git@后面紧跟的名字改为mygithub

git clone git@mygithub:PopFisher/AndroidRotateAnim.git

 

HostName             这个是真实的域名地址

IdentityFile            这里是id_rsa的地址

PreferredAuthentications       表示与服务器公钥进行匹配

User              定义用户名

 

config文件配置如下:

# 配置github.com

Host github.com

HostName github.com

IdentityFile C:\Users\aaa\.ssh\id_rsa_anding

PreferredAuthentications publickey

User xxx(改成你的用户名)

 

# 配置re

Host repo.lacesar.com

HostName repo.lacesar.com

IdentityFile C:\Users\aaa\.ssh\id_rsa

PreferredAuthentications publickey

User xxx(改成你的用户名)

 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Cpp五条/article/detail/438685
推荐阅读
相关标签
  

闽ICP备14008679号