简体   繁体   中英

Windows, Git and the SSH url/path of a bare repository

I am trying to set up a git repository on our Windows server.
I installed OpenSSH for Windows and Git for Windows.
The OpenSSH server runs on port 2345 to filter out generic bots.

I created a bare and shared repository on C:\git\protocolrepo.git
I couldn't reach it with the URL:

ssh://User@domain@server.com:2345:C:/git/protocol.git

It seems to me to be a malformed URL but everywhere I look on the web I get this, but it just doesn't work.

As I found out in this thread: https://github.com/PowerShell/Win32-OpenSSH/issues/895 , the shell might be the cause, so I set the powershell as the default shell of OpenSSH.
This didn't work either and I still needed to use this oddly formed URL.
So I installed Cygwin and set the Cygwin bash as the default shell, and used a more appropriately formed url:

ssh://User@domain@server.com:2345/cygdrive/c/git/protocol.git 

I had a little bit more success with this, but it now states the following error message:

fatal: '/cygdrive/c/git/protocol.git' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.

The access rights should be fine as I make use of the same user alltogether, but I'm not 100% sure how this works on Windows.
I'm not sure either how Git/ssh handles this path on Windows.

On a Linux based server this worked just fine with /git/protocol.git path.

Pushing a new branch to a bare repository is something I haven't done in a while either so that also might be done wrong here, but I can't recall it to be an issue.

What would you recommend to debug this issue?

I would start by checking if an interactive SSH session works, before considering using a Git repo SSH URL.

ssh -p 2345 User@domain@server.com

If it does, try and access /C/git/protocol.git in that interactive shell.

If that works, then try for your git commands the URL

ssh://User@domain@server.com:2345/C/git/protocol.git
# or
ssh://User@domain@server.com:2345/c/git/protocol.git

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