zoukankan      html  css  js  c++  java
  • 一台电脑多个git使用 push 时候出现denied

    http://my.oschina.net/silentboy/blog/220158

    当一台电脑上多个git account 的时候, 出现如下问题,

    $ git push origin master
    ERROR: Permission to UserA/touchme.git denied to UserB.
    fatal: Could not read from remote repository.

    Please make sure you have the correct access rights

    解决方式

    http://www.jianshu.com/p/886aea2fa206

    1: 取消git config --global 的 user, email 配置, 进入单独项目 单独配置

    2: 删除默认的密钥, 重建新的密钥给冲突的account

    3:  添加新密钥到config 文件

    Host github_personal
    HostName github.com
    User UserA
    IdentityFile ~/.ssh/id_personal_rsa
    IdentitiesOnly yes

    Host github_company
    HostName github.com
    User UserB
    IdentityFile ~/.ssh/id_company_rsa
    IdentitiesOnly yes

    如果之后仍然出现验证问题如下:

    $ git push origin master
    Warning: Permanently added the RSA host key for IP address '192.30.252.122' to the list of known hosts.
    Permission denied (publickey).
    fatal: Could not read from remote repository.

    解决办法: 重置repo 的url 为alias下的url

    http://stackoverflow.com/questions/26953071/github-authentication-failed-github-does-not-provide-shell-access

    参考如下: 

    git remote set-url origin git@${alias in config}:UserA/touchme.git

    这样就可以正常push 了 

    $ git push origin master
    Counting objects: 2, done.
    Delta compression using up to 4 threads.
    Compressing objects: 100% (2/2), done.
    Writing objects: 100% (2/2), 363 bytes | 0 bytes/s, done.
    Total 2 (delta 1), reused 0 (delta 0)

    验证添加的密钥能否成功连接github:

    $ ssh -vT git@${alias}

  • 相关阅读:
    ant-design-vue a-tree默认展开所有父节点不生效
    CSS模型简介
    一点BFC的看法
    css提高开发效率的必备代码
    CSS模型简介-逆战班
    CSS 样式:常用居中方法
    rem 自适应布局 js 代码
    CSS 样式 :position-absolute 绝对定位属性
    CSS 样式
    CSS样式字体初解
  • 原文地址:https://www.cnblogs.com/IamThat/p/5363241.html
Copyright © 2011-2022 走看看