2015-09-27 112 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