git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Git problem in windows server

From
PWPhillip Wood <phillip.wood123@gmail.com>
Date
Nov 21, 2024, 14:28 UTC
Message-ID
<15918318-8071-4c20-9e83-9b93a5410683@gmail.com>
In-Reply-To
<e020539e-b66b-4d4d-80da-9f51d4b66683@tool.es>
Hi Luis
On 21/11/2024 10:24, Luis Heredia wrote:
Show 18 quoted lines
> Good day,
> 
> I have a problem that i can not solve after a lot of checks.
> 
> In my windows server 2019 i created a bare repository (c:/gitServer/ 
> git.git). In that server i create a new directory and I can clone it 
> without any problem. The repository is good.
> 
> When I go to my local machine, i can start communication with ssh to the 
> server (cmd ssh ssh://user@serverIp:port). I can navigate to the path of 
> the repository (cd \gitServer\git ) and change anything (copy c: 
> \temp\temp.txt). With this i can be sure that the rights in the server 
> are correct.
> 
> The problem is when i try to clone in my windows 10 local machine (cmd 
> git clone - v ssh://user@serverIp:port/gitServer/git.git c:/temp) i 
> always receive the error "fatal: ´´/gitServer/git.git''  does not appear 
> to be a git repository".

I'm not a Windows expert but I think the problem is that git expects the server to run the command passed to it with a posix compatible shell but the default shell on windows is cmd.exe which uses different quoting rules that cause the command line to be mangled. The solution is either to set the shell used by ssh to bash.exe (see [1] for how to do this) or to use the --upload-pack argument to git clone to execute the command with bash by running

     git clone --upload-pack '"c:\Program Files\Git\bin\bash.exe" -c 
"git upload-pack \"$@\"" git-upload-pack' 
ssh://my.server/c:/gitServer/git.git

(Note I'm assuming that you're typing this in bash, if you're using cmd.exe you'll need to alter the quoting)

If you clone using --upload-pack you'll need to set remote.origin.uploadpack and remote.origin.receivepack to run the appropriate commands when you push and pull

     git config remote.origin.uploadpack '"c:\Program 
Files\Git\bin\bash.exe" -c "git upload-pack \"$@\"'
     git config remote.origin.receivepack '"c:\Program 
Files\Git\bin\bash.exe" -c "git receive-pack \"$@\"'
Best Wishes
Phillip

[1] https://learn.microsoft.com/en-us/windows-server/administration/openssh/openssh-server-configuration#configuring-the-default-shell-for-openssh-in-windows

Show 9 quoted lines
> In server and local machine the version of git is 2.47.0.windows.2
> 
> Can anyone help me ?
> 
> Thanks
> 
> Luis
> 
> 
Previous: Luis HerediaNext: Konstantin Khomoutov
Message 2 of 5 in “Git problem in windows server”
  1. Luis HerediaNov 21, 2024
  2. Phillip WoodNov 21, 2024
  3. Konstantin KhomoutovNov 21, 2024
  4. rsbecker@nexbridge.comNov 21, 2024
  5. Konstantin KhomoutovNov 22, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.