[英]Git, fatal: unable to access 'https://github.com/path/to/repo.git': gnutls_handshake() failed: Error in the pull function
[英]Git push: Missing or invalid credentials. fatal: Authentication failed for 'https://github.com/username/repo.git'
我試圖在新 MacBook 上進行第一次推送,並在git push
后出現此錯誤(在我的舊 MacBook 上一切正常):
Missing or invalid credentials.
Error: connect ECONNREFUSED /var/folders/tx/53fffl0j51qb47mhnlf8zsdc0000gn/T/vscode-git-1d38026c7f.sock
at PipeConnectWrap.afterConnect [as oncomplete] (net.js:1056:14) {
errno: 'ECONNREFUSED',
code: 'ECONNREFUSED',
syscall: 'connect',
address: '/var/folders/tx/53fffl0j51qb47mhnlf8zsdc0000gn/T/vscode-git-1d38026c7f.sock'
}
Missing or invalid credentials.
Error: connect ECONNREFUSED /var/folders/tx/53fffl0j51qb47mhnlf8zsdc0000gn/T/vscode-git-1d38026c7f.sock
at PipeConnectWrap.afterConnect [as oncomplete] (net.js:1056:14) {
errno: 'ECONNREFUSED',
code: 'ECONNREFUSED',
syscall: 'connect',
address: '/var/folders/tx/53fffl0j51qb47mhnlf8zsdc0000gn/T/vscode-git-1d38026c7f.sock'
}
remote: No anonymous write access.
fatal: Authentication failed for 'https://github.com/username/repo.git/'
知道為什么以及如何解決它嗎?
如果您使用的是 linux,只需在命令前添加sudo
。 否則,您必須在命令中添加管理前綴。
如marpo-it的回答中所述,可以取消選中設置git.terminalAuthentication
(從 VSCode 1.45 開始)
這將避免這種情況,對於在集成終端中調用的 Git 命令,例如git push
,您將自動根據您的 GitHub 帳戶進行身份驗證。
原答案:
我已經使用 git config user.name "your username" 和 git config user.password "your password" 設置了憑據,並且可以通過運行
git config --list
來查看這些信息,我在這里缺少什么?
這些不是“憑證”:它們不會幫助您向 GitHub 之類的遠程服務進行身份驗證。
對於 HTTPS URL( https://github.com/<me>/<myRepo>
),您需要:
git config --global credential.helper osxkeychain
)在那里您將輸入您的實際憑據:
但如果問題今天消失了,那么這與 GitHub 事件有關。
Andreas L 在評論中還提到,嘗試從集成的 VS Code 終端進行身份驗證可能會很棘手。
詳見“ git push origin master
Missing or invalid credentials ”,這里:
如果您使用 JSON 設置文件,請在其中插入以下行:
git.terminalAuthentication: false,
重新加載 VSCode window ( shift - control - P打開命令面板然后找到Developer: Reload Window
並按Enter )為我修復了這個問題。
我有一個類似的問題。 我必須修改 git 配置如下:
[credential]
helper = manager
在它被設置為 wincred 之前。
在我的情況下,我收到了錯誤,因為我試圖推送到 HTTPS 遙控器
但相反,我不得不將 go 到 GitHub 上的存儲庫並復制 SSH 地址,看起來像這樣
git@github.com:USER/REPO.git
如果您使用 Windows 10. Go 控制面板並搜索 Windows Credential Manager。 在那里你可以找到 Git/bitbucket url 從那里你可以點擊編輯並更改你的憑證
這不時發生在我身上。 在win 11上運行vscode。我
對於所有交互(克隆、推送等),我將得到相同的響應Missing or invalid credentials
。 我嘗試了各種解決方案但沒有成功。
我仍然可以從命令行生成存儲庫密碼並使用git clone
(例如),在出現提示時復制密碼。 不是很理想。
我發現解決此問題的最簡單和最可靠的方法是重新安裝Git Credential Manager Core 。 這包含在Git 中,用於 Windows 。 The recommended way to install Git Credential Manager Core is just to install Git for Windows although there is also a standalone installer it seems simpler to use Git for Windows install to keep everything in line with latest. 重新安裝后,我的憑據將再次被拾取,而無需我輸入它們。
如果它不適用於您,請不要降級,這個答案可能會對以下提到的情況有所幫助。
注意:此答案特定於運行Linux 的 Windows 子系統的人,帶有 git 服務器的自定義證書,它不適用於沒有WSL 或沒有自定義證書的 WSL 的人
檢查您的發行版是否正在運行,即使我的git gogs 證書已存儲並安裝在 WSL 中,沒有它們,我無法推送或拉取。
對我來說,我的vsCode在遠程斷開的 state 中運行,因為 WSL 發行版已關閉或終止,因此無法獲取我的證書。
重新啟動 WSL 發行版通過提供對我的證書的訪問來重新連接 vsCode 遠程解決了該問題。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.