簡體   English   中英

SSH git 推送時出現“沒有這樣的文件或目錄”錯誤

[英]SSH "no such file or directory" error on git push

我有一個位於~/.ssh/github_rsa的私鑰,相應的公鑰已上傳到我的 Github 帳戶。 我創建了一個存儲庫並將其設置為我正在使用的目錄的遠程,在該目錄的.git文件夾中,我有以下config文件:

[core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
    sshCommand = 'ssh -i ~/.ssh/github_rsa -o IdentitiesOnly=yes'
[remote "repoName"]
    url= git@github.com:myusername/repoName.git
    fetch = +refs/heads/*:refs/remotes/repoName/*

當我運行git push -u repoName main時,出現以下錯誤:

'ssh -i ~/.ssh/github_rsa -o IdentitiesOnly=yes': line 1: ssh -i github_rsa -o IdentitiesOnly=yes: No such file or directory
fatal: Could not read from remote repository.

刪除-o IdentitiesOnly=yes沒有任何效果。 將密鑰的權限從 600 更改為 400 也沒有效果。 該文件肯定存在,並且存在於該路徑中。

gitconfig 不識別單引號。 使用雙引號。

[core]
    sshCommand = "ssh -i ~/.ssh/github_rsa -o IdentitiesOnly=yes"

暫無
暫無

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

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