{"thread":{"id":"62523","subject":"Git problem in windows server","startedAt":"2024-11-21T10:24:45Z","lastAt":"2024-11-22T10:03:44Z","messageCount":5,"participants":["Luis Heredia","Phillip Wood","Konstantin Khomoutov","rsbecker@nexbridge.com"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"507817","messageId":"e020539e-b66b-4d4d-80da-9f51d4b66683@tool.es","threadId":"62523","inReplyTo":null,"subject":"Git problem in windows server","fromName":"Luis Heredia","fromEmail":"luis.heredia@tool.es","sentAt":"2024-11-21T10:24:42Z","receivedAt":"2024-11-21T10:24:45Z","isPatch":false,"sender":{"key":"luis.heredia@tool.es","avatar":null},"body":"Good day,\n\nI have a problem that i can not solve after a lot of checks.\n\nIn my windows server 2019 i created a bare repository \n(c:/gitServer/git.git). In that server i create a new directory and I \ncan clone it without any problem. The repository is good.\n\nWhen I go to my local machine, i can start communication with ssh to the \nserver (cmd ssh ssh://user@serverIp:port). I can navigate to the path of \nthe repository (cd \\gitServer\\git ) and change anything (copy \nc:\\temp\\temp.txt). With this i can be sure that the rights in the server \nare correct.\n\nThe problem is when i try to clone in my windows 10 local machine (cmd \ngit clone - v ssh://user@serverIp:port/gitServer/git.git c:/temp) i \nalways receive the error \"fatal: ´´/gitServer/git.git''  does not appear \nto be a git repository\".\n\nIn server and local machine the version of git is 2.47.0.windows.2\n\nCan anyone help me ?\n\nThanks\n\nLuis\n\n"},{"id":"507823","messageId":"15918318-8071-4c20-9e83-9b93a5410683@gmail.com","threadId":"62523","inReplyTo":"e020539e-b66b-4d4d-80da-9f51d4b66683@tool.es","subject":"Re: Git problem in windows server","fromName":"Phillip Wood","fromEmail":"phillip.wood123@gmail.com","sentAt":"2024-11-21T14:28:56Z","receivedAt":"2024-11-21T14:29:00Z","isPatch":false,"sender":{"key":"phillip.wood@dunelm.org.uk","avatar":null},"body":"Hi Luis\n\nOn 21/11/2024 10:24, Luis Heredia wrote:\n> Good day,\n> \n> I have a problem that i can not solve after a lot of checks.\n> \n> In my windows server 2019 i created a bare repository (c:/gitServer/ \n> git.git). In that server i create a new directory and I can clone it \n> without any problem. The repository is good.\n> \n> When I go to my local machine, i can start communication with ssh to the \n> server (cmd ssh ssh://user@serverIp:port). I can navigate to the path of \n> the repository (cd \\gitServer\\git ) and change anything (copy c: \n> \\temp\\temp.txt). With this i can be sure that the rights in the server \n> are correct.\n> \n> The problem is when i try to clone in my windows 10 local machine (cmd \n> git clone - v ssh://user@serverIp:port/gitServer/git.git c:/temp) i \n> always receive the error \"fatal: ´´/gitServer/git.git''  does not appear \n> to be a git repository\".\n\nI'm not a Windows expert but I think the problem is that git expects the \nserver to run the command passed to it with a posix compatible shell but \nthe default shell on windows is cmd.exe which uses different quoting \nrules that cause the command line to be mangled. The solution is either \nto set the shell used by ssh to bash.exe (see [1] for how to do this) or \nto use the --upload-pack argument to git clone to execute the command \nwith bash by running\n\n     git clone --upload-pack '\"c:\\Program Files\\Git\\bin\\bash.exe\" -c \n\"git upload-pack \\\"$@\\\"\" git-upload-pack' \nssh://my.server/c:/gitServer/git.git\n\n(Note I'm assuming that you're typing this in bash, if you're using \ncmd.exe you'll need to alter the quoting)\n\nIf you clone using --upload-pack you'll need to set \nremote.origin.uploadpack and remote.origin.receivepack to run the \nappropriate commands when you push and pull\n\n     git config remote.origin.uploadpack '\"c:\\Program \nFiles\\Git\\bin\\bash.exe\" -c \"git upload-pack \\\"$@\\\"'\n     git config remote.origin.receivepack '\"c:\\Program \nFiles\\Git\\bin\\bash.exe\" -c \"git receive-pack \\\"$@\\\"'\n\nBest Wishes\n\nPhillip\n\n[1] \nhttps://learn.microsoft.com/en-us/windows-server/administration/openssh/openssh-server-configuration#configuring-the-default-shell-for-openssh-in-windows\n\n\n\n> In server and local machine the version of git is 2.47.0.windows.2\n> \n> Can anyone help me ?\n> \n> Thanks\n> \n> Luis\n> \n> \n\n"},{"id":"507831","messageId":"20241121190522.6s63bsvhxm3w5f5b@carbon","threadId":"62523","inReplyTo":"e020539e-b66b-4d4d-80da-9f51d4b66683@tool.es","subject":"Re: Git problem in windows server","fromName":"Konstantin Khomoutov","fromEmail":"kostix@bswap.ru","sentAt":"2024-11-21T19:05:22Z","receivedAt":"2024-11-21T19:05:39Z","isPatch":false,"sender":{"key":"kostix@bswap.ru","avatar":null},"body":"On Thu, Nov 21, 2024 at 11:24:42AM +0100, Luis Heredia wrote:\n\n[...]\n> The problem is when i try to clone in my windows 10 local machine (cmd git\n> clone - v ssh://user@serverIp:port/gitServer/git.git c:/temp) i always\n> receive the error \"fatal: ´´/gitServer/git.git''  does not appear to be a\n> git repository\".\n\nDoes it work if you call\n\n  git clone ssh://user@serverIp:port/c/gitServer/git.git\n\nor may be\n\n  git clone ssh://user@serverIp:port/c:/gitServer/git.git\n\n?\n\nBasically the problem appears to be in that the Git process spawned remotely\nin the SSH session set up by your local Git process, is given the path\ncomponent of the repository URL, which is \"/gitServer/git.git\" in your case.\nObviously, this path is not correct on Windows filesystems.\n"},{"id":"507832","messageId":"035401db3c4b$91ca9c70$b55fd550$@nexbridge.com","threadId":"62523","inReplyTo":"20241121190522.6s63bsvhxm3w5f5b@carbon","subject":"RE: Git problem in windows server","fromName":"","fromEmail":"rsbecker@nexbridge.com","sentAt":"2024-11-21T19:28:34Z","receivedAt":"2024-11-21T19:28:51Z","isPatch":false,"sender":{"key":"randall.becker@nexbridge.ca","avatar":"https://avatars.githubusercontent.com/u/28956764?v=4"},"body":"On November 21, 2024 2:05 PM, Konstantin Khomoutov wrote:\n>On Thu, Nov 21, 2024 at 11:24:42AM +0100, Luis Heredia wrote:\n>\n>[...]\n>> The problem is when i try to clone in my windows 10 local machine (cmd\n>> git clone - v ssh://user@serverIp:port/gitServer/git.git c:/temp) i\n>> always receive the error \"fatal: ´´/gitServer/git.git''  does not\n>> appear to be a git repository\".\n>\n>Does it work if you call\n>\n>  git clone ssh://user@serverIp:port/c/gitServer/git.git\n>\n>or may be\n>\n>  git clone ssh://user@serverIp:port/c:/gitServer/git.git\n>\n>?\n>\n>Basically the problem appears to be in that the Git process spawned\nremotely in the\n>SSH session set up by your local Git process, is given the path component\nof the\n>repository URL, which is \"/gitServer/git.git\" in your case.\n>Obviously, this path is not correct on Windows filesystems.\n\nSome SSH servers restrict interactions to a specific directory rather than\nallowing access\nto the root of the disk. I got around that by setting up a link (via\nCygwin64) to the target\nlocation, which bypasses the configured SSH root. It would then require a\ndifferent\nURI to account for that.\n\n--Randall\n\n"},{"id":"507892","messageId":"20241122100335.jz2rku42x42fmgfd@carbon","threadId":"62523","inReplyTo":"e020539e-b66b-4d4d-80da-9f51d4b66683@tool.es","subject":"Re: Git problem in windows server","fromName":"Konstantin Khomoutov","fromEmail":"kostix@bswap.ru","sentAt":"2024-11-22T10:03:35Z","receivedAt":"2024-11-22T10:03:44Z","isPatch":false,"sender":{"key":"kostix@bswap.ru","avatar":null},"body":"On Thu, Nov 21, 2024 at 11:24:42AM +0100, Luis Heredia wrote:\n\nCross-posted to the Git-for-Windows mailing list by the OP:\nhttps://groups.google.com/g/git-for-windows/c/4DjhUXPF6t4/m/rEBsAtPYAQAJ\n\n"}]}