简体   繁体   中英

TortoiseGit: Unable to Git clone private repository on VPS using SSH

I am trying to git clone a repository using TortoiseGit. I only have access of SSH to my git repository on VPS. I am getting the following error:

git.exe clone --progress -v "ssh://git@xx.xx.xx.xx/home/git/git-repo/myproject.git" "C:\xampp\htdocs\myproject"

Cloning into 'C:\xampp\htdocs\myproject'...
/usr/bin/bash: git@xx.xx.xx.xx: No such file or directory
fatal: Could not read from remote repository.

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

However, I am able to git clone my private repository using Git Bash on windows. That is strange. Am I doing correct while using TortoiseGit for SSH?

Although I'm not familiar with TortoiseGit, it looks like you should be using a syntax which is common amongst many application where copying is done over SSH. That is: <username>@<server>:/path/to/thing/that/needs/copying . (Note the colon near the middle.)

I propose change the command you are running to put a colon just before /home :

git.exe clone --progress -v "ssh://git@xx.xx.xx.xx:/home/git/git-repo/myproject.git" "C:\xampp\htdocs\myproject"

However, I am able to git clone my private repository using Git Bash on windows

Since you are on Windows, try for testing to use and uncompress the latest Git for Windows portable archive PortableGit-2.19.0-64-bit.7z.exe anywhere you want.

Then setup a simplified path in a CMD session.

set PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem
set GIT_HOME=C:\Path\to\Git
set PATH=%GIT_HOME%;%GIT_HOME%\bin;%GIT_HOME%\usr\bin;%GIT_HOME%\mingw64\bin;%PATH%

Check that the exact same command than the one used by TortoiseGit is still working:

git.exe clone --progress -v "ssh://git@xx.xx.xx.xx/home/git/git-repo/myproject.git" "C:\xampp\htdocs\myproject"

Finally, still from that CMD, launch the Tortoisegitproc.exe GUI executable, and see if the clone can proceed from this session.

If you prefer to clone using ssh key, you need to create and add ssh key to git repositories ssh public keys. Use ssh-keygen to generate your ssh key

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM