2015-09-27 113 views
3

我查了很多帖子,但没有任何帮助。git推显示错误的用户名

有一个远程回购是这样的:https://github.com/cakes/blue.git

全球gitconfig是:

$ cat ~/.gitconfig 
[user] 
     name = blake.shaw 
[http] 
     sslCaInfo = C:/bin/certificate.crt 

这需要一个证书,因此把它作为http.sslCaInfo和证书已被添加到git的bin文件夹作为好。

克隆后,远程源URL设置为一样的东西:[email protected]:cakes/blue.git

的id_rsa和id_rsa.pub也创建。 id_rsa.pub已被添加到github(远程)中的ssh密钥中。

当我尝试做一个git push origin master,它抛出一个错误:

ERROR: Permission to cakes/blue.git denied to blake-shaw 
fatal: Could not read from remote repository. 

Please make sure you have the correct access rights 
and the repository exists. 

这里有两个问题:

  1. 在URL中的用户名说blake-shaw,而不是blake.shaw。如何重置它?

  2. 使用url作为尝试:https://github.com/cakes/blue.git和使用源代码树,试图推动,但随后抛出下面的错误:

    remote: Permission to cakes/blue.git denied to blake.shaw. 
    fatal: unable to access 'https://github.com/cakes/blue.git/': The requested URL returned error: 403 
    

回答

0

The username in the url says blake-shaw instead of blake.shaw. How to reset it?

检查您的~/.ssh/id_rsa注册到github.com/blake.shaw帐户再克隆。

Tried using the url as : https://github.com/cakes/blue.git

检查用SourceTree推送时使用的用户帐户。

但更普遍,确保回购blue.git正在github.com/blake.shaw用户帐户,否则将无法正常工作(因为blake.shaw不回购的所有者)

+0

感谢@VonC!第二个实际工作。我分叉回购并创建了一个拉请求。关于第一个问题,我已将id_rsa注册到blake.shaw的帐户,但后来我想我试图推到一个回购商店,因为我不是店主 – allout

1
  1. 你有没有在任何其他文件〜 /.ssh目录除了生成的id_rsa和id_rsa.pub?

  2. 为了正常工作(不必每次都输入用户名和密码),克隆的远程repo应该以SSL模式复制。尝试使用SSL地址 - git clone [email protected]:cakes/blue.git