簡體   English   中英

Git 在 windows 上克隆:git@github.com 不是 ZBA9F11ECC3497BD6993B933E50Z 命令

[英]Git clone on windows : git@github.com is not a git command

我正在嘗試從 github 和另一種形式 gitlab 克隆存儲庫 ssh 方式

我在 windows 編輯:使用 Git v 2.29.2.2

我收到以下錯誤,我不明白它的來源:

$ git clone git@github.com:math-gallou/AI21_TPs.git
Cloning into 'AI21_TPs'...
git: 'git@github.com' is not a git command. See 'git --help'.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

所以我也嘗試了:

$ git clone "ssh://git@github.com:math-gallou/AI21_TPs.git"

$ git clone ssh://git@github.com:math-gallou/AI21_TPs.git

但同樣的錯誤出現了。

當我執行ssh -v git@github.com時,我可以成功連接。

那么我錯過了什么?

首先,如果您嘗試使用 ssh:// 語法,那么 URL 將是:

git clone ssh://git@github.com/math-gallou/AI21_TPs.git
                            ^^^ /, not :

其次,檢查您是否有一個%USERPROFILE%\.ssh\config文件,其中包含github.com主機條目,其內容可能不正確或被誤解。

在我的例子中,我定義了系統環境變量 GIT_SSH 來使用我安裝的 openssh,然后 git 壞了,我得到了git: 'git@github.com' is not a git command. See 'git --help'. git: 'git@github.com' is not a git command. See 'git --help'. .

刪除系統環境變量 GIT_SSH 后一切正常。

然后我嘗試定義用戶環境變量 GIT_SSH 並重新啟動系統(我在之前的嘗試中沒有重新啟動系統),不知何故,現在我的 git 可以與我安裝的 openssh 一起正常工作。 我不知道在我之前的嘗試中哪個部分是錯誤的,但我決定不在這上面浪費更多時間。

暫無
暫無

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

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