簡體   English   中英

Git無法從PowerShell推送

[英]Git can't push from PowerShell

我最近使用Windows Installer更新到git v 2.14。 之后,我像往常一樣繼續使用組織的私有存儲庫 ,根據需要add文件, commit等等。最終,當我從PowerShell中push ,收到以下錯誤:

> git push
remote: Repository not found.
fatal: repository 'https://github.com/<User>/<Repo>.git/' not found

導航到提到的URL,顯示了我的存儲庫,其中包含先前存在的所有提交。 自更新以來我所做的工作尚未提交。

然后,我去檢查Windows命令提示符,收到相同的錯誤消息。 在Git Bash上發生了同樣的事情。

在本地存儲庫上執行的命令( git commitgit addgit reset等)運行正常。 需要與遠程通信的其他命令產生相同的結果。 git fetchgit clone這樣的東西顯示錯誤:

> git clone 'https://github.com/<User>/<Repo>.git'
Cloning into '<Repo>'...
remote: Repository not found.
fatal: repository 'https://github.com/<User>/<Repo>.git/' not found

我很確定這是我的帳戶與組織的私人存儲庫進行通信的方式的問題,但是我找不到解決方法。

有人遇到過這個問題嗎? 有任何想法嗎?

一段時間或嘗試其他操作之后,我從Git GUI打開了存儲庫。 當我嘗試推送時,它要求輸入我的電子郵件和密碼(PowerShell總是會要求該密碼)。 添加所有信息,一切順利。

我再次從PowerShell嘗試,沒有收到任何提示輸入憑據的提示。 檢查git config --global -list (如git config --global -list所建議)列出了credential.helper=wincred 顯然,在更新過程中,我沒有勾選啟用Windows的Git Credential Manager的選項。 它可能已經從以前的存儲庫中保存了我的密碼或輸入了錯誤,所以憑據是錯誤的。

1因為credential.helper鍵是一個多值配置列表,所以一旦設置了一個助手,就無法“取消設置”。 因此,如果您的系統/ etc / gitconfig設置了一個,則將永遠無法避免運行它,而只能在頂部添加自己的幫助器。

以下行對我有用:

git config --global credential.helper 0

如果所有問題都從命令行指向您出現連接問題,那么您應該檢查git config來查看代理設置是否正確。 以下是一些適合您的指針。

顯示您的git設置PS> git config --global --list

設置與代理服務器的HTTP連接將以下設置添加到.gitconfig文件的http項目。

[http] proxy =:您還可以使用以下config命令對其進行配置:

PS> git config --global http.proxy <address of the proxy server>:<port of the proxy server>

建立與用戶身份驗證的代理服務器的HTTP連接將以下設置添加到.gitconfig文件的http項目:

[HTTP]

proxy = http://<username>:<password>@<address of the proxy server>:<port of the proxy server>

您也可以使用以下config命令對其進行配置

PS> git config --global http.proxy http://<username>:<password>@<address of the proxy server>:<port of the proxy server>

暫無
暫無

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

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