美文网首页
mac多git账户续

mac多git账户续

作者: ouhoo | 来源:发表于2017-09-22 00:04 被阅读0次

同时配置oscine和github

生成不同的rsa key文件

举例:

mymac@mymacdeMacBook-Pro:~/.ssh$ ssh-keygen -t rsa -C "xx@xxx.com”

Generating public/private rsa key pair.

Enter file in which to save the key (/Users/mymac/.ssh/id_rsa): id_rsa_xxxgitlib

Enter passphrase (empty for no passphrase):

Enter same passphrase again:

Your identification has been saved in id_rsa_xxxgitlib.

Your public key has been saved in id_rsa_xxxgitlib.pub.

The key fingerprint is:

SHA256:kc4U5Ig+3K+HXdLswXH4zDEXHjZ5uG5S1F8Fpwxx@xxx.com

分别在两个网站配置public key

执行

localhost:.ssh mymac$ ssh -T git@git.oschina.net

Welcome to Git@OSC, jrrx!

localhost:.ssh mymac$ ssh -T git@github.com

Hi xxxx! You've successfully authenticated, but GitHub does not provide shell access.

(1)如果不成功,那么先删除kknow_hosts文件,然后执行ssh-add -D,

(2)然后再分别添加ssh-add rsafile

localhost:.ssh mymac$ ssh-add id_rsa_github

Identity added: id_rsa_github (id_rsa_github)

localhost:.ssh mymac$ ssh-add id_rsa_oschina

Identity added: id_rsa_oschina (id_rsa_oschina)

localhost:.ssh mymac$ ssh-add -l

2048 SHA256:3aGW/B+hBNINi+nsVvY7unV0u4CtIrbzkRg3Cm1E id_rsa_github (RSA)

2048 SHA256:d0Qk0OQxZtGOGjM+CLIA1kr7tNbHcNge+wxT5A8g id_rsa_oschina (RSA)

git commit -m “this is the commit comment”的时候报错

localhost:Learn-SpringBoot mymac$ git commit -m "add new file readme.txt"

*** 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.

fatal: unable to auto-detect email address (got 'mymac@localhost.(none)')

由于我是多账户,所以我在仓库的根目录下单独添加,

localhost:Learn-SpringBoot mymac$ git config user.name "ouhoo"

localhost:Learn-SpringBoot mymac$ git config user.name

ouhoo

localhost:Learn-SpringBoot mymac$ git config user.email "ouhoo@qq.com"

localhost:Learn-SpringBoot mymac$ git config user.email

puhoo@qq.com

localhost:Learn-SpringBoot mymac$ git config --list

Git全局配置和单个仓库的用户名邮箱配置http://blog.csdn.net/luohai859/article/details/50679859

Git配置用户名与邮箱http://www.cnblogs.com/gudi/p/6597660.html

GithubHelphttps://help.github.com/articles/error-permission-denied-publickey/

相关文章

  • mac多git账户续

    同时配置oscine和github 生成不同的rsa key文件 举例: mymac@mymacdeMacBook...

  • Mac 上配置多个git账号

    参考 1、mac 下使用多个 git 账户配置2、Mac多个Git账户配置3、如何在一台电脑上使用多个git帐号 ...

  • # Mac下配置多个Git账户

    Mac下配置多个Git账户 代码托管到github、gitlab、gitee上,每个托管平台都对应一个git账户。...

  • Git 系列文章

    GIT 初识 Git的基础操作 Git的远程操作 Git的分支管理 Git标签操作 Git团队协作 Git 多账户...

  • Mac Git配置多账户 gitlab 和 gitee

    使用场景:在gitlab 和 gitee上各一个账号,通过ssh访问git。 1、首先清空全局的邮箱和用户名 2、...

  • git 命令

    Mac生成SSH Keys使用git管理代码的时候,需要生成一个公匙key,添加到自己的git账户中,才能从git...

  • git 多账户配置

    1、生成多个密钥 ssh-keygen -t rsa -C "邮箱" -f 文件名 2、在 .ssh 目录下创建 ...

  • git 多账户配置

    环境 MacOS 检查是否已有全局账户设置: 如果都没有返回值,就说明没有已配置的 git 账户,否则请删除账户信...

  • Git多账户配置

    日常开发过程中,我们可能遇到需要在同一电脑上配置多个Git账户的情况;github、公司的git服务器等,这时候我...

  • git多账户设置

    你是否遇到过在公司电脑撸码时需要链接到公司的git私服,同时又要写写个人的代码到github的尴尬,我想你一定有过...

网友评论

      本文标题:mac多git账户续

      本文链接:https://www.haomeiwen.com/subject/erlxextx.html