2016-08-13 21 views
2

每次我想提交命令「git push heroku master」時,我在PowerShell中要求輸入憑據。當我輸入heroku證書(默認連接到git)時,我收到錯誤消息。推動更改Git無法正常工作

但是,當我鍵入包含在我的主目錄中的netrc文件中的憑證時,那麼這個東西就起作用了。但是我認爲密碼是散列的。每次我想將更改推送到git時,如何避免輸入憑據?

UPDATE:

PS C:\Users\Dragan\heroku_workspace\python-getting-started> git push heroku master 
github --credentials get: github: command not found 
Username for 'https://git.heroku.com': [email protected] 
Password for 'https://[email protected]@git.heroku.com': 
github --credentials erase: github: command not found 
remote: !  WARNING: 
remote: !  Do not authenticate with username and password using git. 
remote: !  Run `heroku login` to update your credentials, then retry the git command. 
remote: !  See documentation for details: Https://devcenter.heroku.com/articles/http-git#authentication 
fatal: Authentication failed for 'https://git.heroku.com/mysterious-river-71834.git/' 
+0

什麼是你獲得錯誤信息?你應該只需要一次''heroku登錄'。 – Harrison

+0

@Harrison與我的heroku憑據comand heroku登錄功能。然而,當我輸入與以前相同的憑證時,並不是我的命令。它只有當我輸入在netrc文件中找到的散列密碼時才起作用,除此之外,每當我想要執行git push時都必須執行此操作......錯誤消息在我更新的問題描述中題。 – Adam

回答

2

一個常見的錯誤使用,而不是SSH默認(HTTPS)克隆。您可以將您的資料庫,點擊左邊的URL字段中的SSH按鈕和遠程更新來源URL這樣更正此:
git remote set-url origin [email protected]:username/repo.git

,或者如果你的倉庫已經然後點擊綠色按鈕CLONE OR DOWNLOAD並選擇使用SSH

啓用SSH認證

$ heroku create --ssh-git

重定向高大HTTPS呼籲通過SSH (If you want to always use SSH Git with Heroku on a particular machine)

$ git config --global url.ssh://[email protected]/.insteadOf https://git.heroku.com/

要生成公鑰:

ssh-keygen -t rsa出版社在第一提示符下輸入使用默認文件位置。接下來,輸入密鑰的安全密碼。

+0

你能更具體嗎?我到底需要從https切換到ssh? – Adam

+0

1.如果你去github網站和「登錄」2.進入你的資料庫主頁面。 3.然後在'RIGHT-SIDE'上你會看到一個說明'CLONE或DOWNLOAD'的GREEN BUTTON'點擊它 –

+0

我發現我可以從https轉到ssl,但是,在這種情況下git倉庫是由heroku自動創建的,我不知道在哪裏找到那個。這是鏈接:https://git.heroku.com/mysterious-river-71834.git – Adam

0

如果你正在使用v1.9.3或更高版本Git for Windows,你可以做以下

git config --global credential.helper wincred 

請注意,這個機制存儲在Windows憑據存儲您的用戶名/密碼。

在相對較新的版本中,Git Credential Manager for WindowsGit for Windows捆綁在一起,默認情況下啓用,您可能必須覆蓋用於Heroku的credential.helper配置。 GCM似乎是爲VSTS和GitHub設計的,我不是如何與其他服務器行爲。

0

爲我工作:

  1. 運行heroku login使用Windows命令提示符cmd.exe。這會降低你的API密鑰到您的_netrc此時你可以打開的cygwin或混帳bash和做任何你需要

  2. .gitconfig刪除helper = manager行,以便它不再登記憑證助手和停止它顯示出來。

    (在C:\Users\username\.gitconfig

  3. 重命名_netrc文件。NETRC在Windows 7中的用戶目錄:

    cd %home%

    REN _netrc .netrc

見:

'git push heroku master' is still asking for authentication

https://github.com/heroku/cli/issues/84#issuecomment-170689175