簡體   English   中英

使用Moovweb時Windows上的權限被拒絕(publickey)錯誤

[英]Permission denied (publickey) errors on Windows when using Moovweb

我能夠在我的Mac和Linux機器上使用SSH密鑰和Moovweb憑證進行身份驗證,生成,推送等。

但是,在我的Windows機器上,使用Git Bash,我收到SSH Permission denied (publickey)錯誤。 錯誤消息如下:

$> moov generate 123dsfsdsf nytimes.com
Running environment checks.
Verifying that git is installed...OK
Checking that current 123dsfsdsf directory doesn't exist...OK
Registering project with MoovCloud.
Authenticating with MoovCloud.
Checking for git access...Enter passphrase for key '/Users/firstname.lastname/.ssh/id_rsa':
Enter passphrase for key '/Users/firstname.lastname/.ssh/id_rsa':
FAILED
> Need to upload an ssh key in order to generate a project...
Found the following SSH public keys:
1 ) id_rsa.pub
2 ) new_rsa.pub
Which would you like to use with your Moovweb account? 2
Uploading public key...
Successfully uploaded public key new_rsa.pub as 'firstname.lastname@GGT.local'
You are now ready to push projects to MoovCloud!
Creating project in MoovCloud...OK
Generating files...OK
Cloning project locally.
Enter passphrase for key '/Users/firstname.lastname/.ssh/id_rsa':
Enter passphrase for key '/Users/firstname.lastname/.ssh/id_rsa':
Cloning into '123dsfsdsf'...
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
ERROR:   Error cloning git repo: exit status 128
Please try cloning the repository (git clone moov@git.moovweb.com:firstnameglastname/123dsfsdsf.git) again later.
Try 'moov help generate' to find out details.

看起來像Windows特定的SSH錯誤。 任何解決方法?

因此,如前面的答案所述,Windows中的Permission denied錯誤是因為您嘗試使用id_rsa以外的密鑰。

在嘗試通過SSH連接到服務器時,Windows缺乏Linux和Mac必須嘗試所有公鑰的花俏。 如果您正在使用ssh命令,則可以通過傳遞-i標志,然后傳遞要使用的密鑰的路徑來告訴它使用哪個密鑰:

ssh -i ~/.ssh/moovweb_rsa moov@git.moovweb.com

如果您已將moovweb_rsa.pub上傳到控制台(通過moov login命令或控制台UI),則上述命令應該可以正常工作。 但是,嘗試任何與git相關的命令都會失敗,因為Git不能讓您在連接到git remote時選擇使用哪個鍵。 因此,SSH被強制使用默認密鑰id_rsa ,如果該密鑰不起作用(或不存在),則連接失敗並顯示權限被拒絕錯誤。

如其他答案所示,一種可能的解決方案是簡單地將您的密鑰重命名為id_rsa 對大多數人來說,這是一個很好的解決方案。 但是,如果您已經有一個id_rsa密鑰,並且您希望使用與Moovweb不同的密鑰,則可以通過添加以下內容來編輯~/.ssh/config文件:

Host git.moovweb.com
    IdentityFile ~/.ssh/moovweb_rsa

如果將上面的行附加到~/.ssh/config文件(如果它不存在則創建它),您應該能夠成功地讓Git與Moovweb遠程git服務器通信。 配置基本上告訴SSH,對於給定的主機( git.moovweb.com ),SSH應該使用給定的密鑰而不是默認密鑰。

所有Git遙控器都會發生這種情況並不值得; 與Github,Heroku等的交互......在Windows中也遇到了這個問題。 如果您願意,可以輕松擴展~/.ssh/config文件,為每個服務使用單獨的SSH密鑰:

Host git.moovweb.com
    IdentityFile ~/.ssh/moovweb_rsa

Host github.com
    IdentityFile ~/.ssh/github_rsa

Host heroku.com
    IdentityFile ~/.ssh/heroku_rsa

快速而骯臟的解決方案:僅使用默認的id_rsa.pub密鑰

一些說明:

  1. 確保輸入正確的密碼到id_rsa.pub
  2. 不要用你的其他關鍵, new_rsa.pub

事實證明,Windows Git Bash並不具備Mac / Linux用戶習慣的所有酷工具。 具體來說,您沒有運行ssh-agent來幫助處理多個密鑰。 沒有ssh-agentgit命令似乎只使用默認的id_rsa.pub鍵。

您可以在Github的SSH故障排除指南之后驗證這是一個SSH / Windows問題。 無論您嘗試連接哪個SSH / Git服務器,都會獲得Permission denied (publickey)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM