简体   繁体   English

Windows、Git 和 SSH 裸存储库的 URL/路径

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

I am trying to set up a git repository on our Windows server.我正在尝试在我们的 Windows 服务器上设置 git 存储库。
I installed OpenSSH for Windows and Git for Windows.我为 Windows 和 Git 为 Windows 安装了 OpenSSH。
The OpenSSH server runs on port 2345 to filter out generic bots. OpenSSH 服务器在端口 2345 上运行以过滤掉通用机器人。

I created a bare and shared repository on C:\git\protocolrepo.git我在 C:\git\protocolrepo.git 上创建了一个裸共享存储库
I couldn't reach it with the URL:我无法使用 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.在我看来,它似乎是一个畸形的 URL 但是我在 web 上看到的所有地方我都明白了,但它只是不起作用。

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. 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.这也不起作用,我仍然需要使用这个奇怪的 URL。
So I installed Cygwin and set the Cygwin bash as the default shell, and used a more appropriately formed url:所以我安装了 Cygwin 并将 Cygwin bash 设置为默认 shell,并使用了更合适的 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.访问权限应该没问题,因为我完全使用同一个用户,但我不能 100% 确定这在 Windows 上是如何工作的。
I'm not sure either how Git/ssh handles this path on Windows.我也不确定 Git/ssh 如何处理 Windows 上的这条路径。

On a Linux based server this worked just fine with /git/protocol.git path.在基于 Linux 的服务器上,这与/git/protocol.git路径配合得很好。

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. 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.如果是这样,请尝试在该交互式 shell 中访问/C/git/protocol.git

If that works, then try for your git commands the URL如果可行,请尝试使用 git 命令 URL

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 通过挂钩(GIT,Windows,GitStack)推送后合并分段存储库裸存储库 - Merge staging repository bare repository after push via hooks (GIT, Windows, GitStack) Jenkins无法在Windows上通过Git / SSH克隆Git存储库 - Jenkins can not clone Git repository over Git/SSH on Windows Git扩展-无法在Windows的网络驱动器中推送git裸存储库 - Git Extensions - Can't push to git bare repository in a network drive on Windows 用于Windows的Git SSH客户端和.ssh / config文件的错误路径 - Git SSH client for windows and wrong path for .ssh/config file 如何在Windows上通过ssh创建可访问的Git存储库? - How to create Git repository accessible via ssh on Windows? 无法从Windows服务器克隆GIT存储库,但可以进行SSH - Cannot Clone GIT Repository from windows server but can SSH 如何在Windows上使用ssh和IPV6连接到GIT远程存储库 - How to connect to a GIT remote repository with ssh and IPV6 on Windows 如何通过Windows上的ssh停止git来解决错误的路径? - How to stop git via ssh on windows from resolving the wrong path? 在Windows Apache服务器上设置git裸仓库 - Setup a git bare repo on a windows apache server Windows在git远程存储库路径中添加额外的斜杠 - Windows puts extra slash in git remote repository path
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM