git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Git problem in windows server
@ 2024-11-21 10:24 Luis Heredia
  2024-11-21 14:28 ` Phillip Wood
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Luis Heredia @ 2024-11-21 10:24 UTC (permalink / raw)
  To: git

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".

In server and local machine the version of git is 2.47.0.windows.2

Can anyone help me ?

Thanks

Luis


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Git problem in windows server
  2024-11-21 10:24 Git problem in windows server Luis Heredia
@ 2024-11-21 14:28 ` Phillip Wood
  2024-11-21 19:05 ` Konstantin Khomoutov
  2024-11-22 10:03 ` Konstantin Khomoutov
  2 siblings, 0 replies; 5+ messages in thread
From: Phillip Wood @ 2024-11-21 14:28 UTC (permalink / raw)
  To: Luis Heredia, git

Hi Luis

On 21/11/2024 10:24, Luis Heredia wrote:
> 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



> In server and local machine the version of git is 2.47.0.windows.2
> 
> Can anyone help me ?
> 
> Thanks
> 
> Luis
> 
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Git problem in windows server
  2024-11-21 10:24 Git problem in windows server Luis Heredia
  2024-11-21 14:28 ` Phillip Wood
@ 2024-11-21 19:05 ` Konstantin Khomoutov
  2024-11-21 19:28   ` rsbecker
  2024-11-22 10:03 ` Konstantin Khomoutov
  2 siblings, 1 reply; 5+ messages in thread
From: Konstantin Khomoutov @ 2024-11-21 19:05 UTC (permalink / raw)
  To: Luis Heredia; +Cc: git

On Thu, Nov 21, 2024 at 11:24:42AM +0100, Luis Heredia wrote:

[...]
> 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".

Does it work if you call

  git clone ssh://user@serverIp:port/c/gitServer/git.git

or may be

  git clone ssh://user@serverIp:port/c:/gitServer/git.git

?

Basically the problem appears to be in that the Git process spawned remotely
in the SSH session set up by your local Git process, is given the path
component of the repository URL, which is "/gitServer/git.git" in your case.
Obviously, this path is not correct on Windows filesystems.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: Git problem in windows server
  2024-11-21 19:05 ` Konstantin Khomoutov
@ 2024-11-21 19:28   ` rsbecker
  0 siblings, 0 replies; 5+ messages in thread
From: rsbecker @ 2024-11-21 19:28 UTC (permalink / raw)
  To: 'Konstantin Khomoutov', 'Luis Heredia'; +Cc: git

On November 21, 2024 2:05 PM, Konstantin Khomoutov wrote:
>On Thu, Nov 21, 2024 at 11:24:42AM +0100, Luis Heredia wrote:
>
>[...]
>> 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".
>
>Does it work if you call
>
>  git clone ssh://user@serverIp:port/c/gitServer/git.git
>
>or may be
>
>  git clone ssh://user@serverIp:port/c:/gitServer/git.git
>
>?
>
>Basically the problem appears to be in that the Git process spawned
remotely in the
>SSH session set up by your local Git process, is given the path component
of the
>repository URL, which is "/gitServer/git.git" in your case.
>Obviously, this path is not correct on Windows filesystems.

Some SSH servers restrict interactions to a specific directory rather than
allowing access
to the root of the disk. I got around that by setting up a link (via
Cygwin64) to the target
location, which bypasses the configured SSH root. It would then require a
different
URI to account for that.

--Randall


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Git problem in windows server
  2024-11-21 10:24 Git problem in windows server Luis Heredia
  2024-11-21 14:28 ` Phillip Wood
  2024-11-21 19:05 ` Konstantin Khomoutov
@ 2024-11-22 10:03 ` Konstantin Khomoutov
  2 siblings, 0 replies; 5+ messages in thread
From: Konstantin Khomoutov @ 2024-11-22 10:03 UTC (permalink / raw)
  To: Luis Heredia; +Cc: git

On Thu, Nov 21, 2024 at 11:24:42AM +0100, Luis Heredia wrote:

Cross-posted to the Git-for-Windows mailing list by the OP:
https://groups.google.com/g/git-for-windows/c/4DjhUXPF6t4/m/rEBsAtPYAQAJ


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-11-22 10:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-21 10:24 Git problem in windows server Luis Heredia
2024-11-21 14:28 ` Phillip Wood
2024-11-21 19:05 ` Konstantin Khomoutov
2024-11-21 19:28   ` rsbecker
2024-11-22 10:03 ` Konstantin Khomoutov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).