1

I created a bare repository on windows 10 workstation which is attached to company private network

cd c:\users\remoteusername\gitserver
mkdir myrepo.git
cd myrepo.git
git init --bare --shared=group

Thereafter I setup an ssh server on this windows server using Win32_OpenSSH

On my windows 7 client, I first create a pair of public/private ssh keys from git shell and added it to ssh-agent:

cd c:\users\localusername\.ssh\
ssh-keygen.exe -t ed25519
eval `ssh-agent -s`
ssh-add.exe id_ed25519

This generated public/private key pair id_ed25519.pub and id_ed25519 on my windows 7 client machine.

Then I copied the contents from public key id_ed25519.pub to file c:\users\remoteusername.ssh\authorized_keys on windows 10 server which hosts my bare git repository.

I restart ssh daemon on the windows 10 server

net stop sshd
net start sshd

hello

Next, on my windows 7 client, I connect to my companies private network through VPN. I first check if I could connect from my Windows 7 client to Windows 10 machine via ssh using my remoteusername:

ssh remoteusername@myorg.com

I was successfully able to connect using my remoteusername. However, if I used 'git' as user name with ssh, I can't connect:

ssh git@myorg.com
git@myorg.com's password:
Permission denied, please try again.

Next I try to clone my remote repository on my local machine but it fails:

git clone ssh://remoteusername@myorg.com/C:/Users/remoteusername/gitserver/myrepo.git testrepo
Cloning into 'testrepo'... 
remoteusername@myorg.com's password: 'git-upload-pack' is not recognized as an internal or external command, 
operable program or batch file.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

To resolve error with unrecognized command 'git-upload-pack', on my Windows 10 server, I added paths of git sub-folders with binaries to my environment PATH variable:

C:\Users\remoteusername\AppData\Local\Programs\Git\bin
C:\Users\remoteusername\AppData\Local\Programs\Git\mingw64\bin

I again try to clone my remote repository on my local machine but it fails with a different error:

git clone ssh://remoteusername@myorg.com:/C/Users/remoteusername/gitserver/myrepo.git testrepo
Cloning into 'testrepo'...
remoteusername@myorg.com's password:
fatal: ''/C/Users/remoteusername/gitserver/myrepo.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.

Anyone knows what is that I am missing and how to resolve this ?

nurabha
  • 1,152
  • 3
  • 18
  • 42
  • 1
    i suggest that you start by trying to 'dir' the remote directory using your shell settings. I do not think that it has anything to do with 'git' – Serge Sep 24 '19 at 00:54
  • Ok I tried 'dir' and I get command output returned over ssh. What next ? – nurabha Sep 24 '19 at 00:58
  • 1
    this is encouraging :-). Now you can check this: https://stackoverflow.com/questions/53834304/how-do-i-git-clone-from-a-windows-machine-over-ssh – Serge Sep 24 '19 at 01:08
  • 1
    Possible duplicate of [How do I git clone from a Windows machine over ssh?](https://stackoverflow.com/questions/53834304/how-do-i-git-clone-from-a-windows-machine-over-ssh) – Serge Sep 24 '19 at 01:08
  • Tried but doesn't work!! – nurabha Sep 24 '19 at 02:07
  • What Git version are you using on client and server? – VonC Sep 24 '19 at 04:46
  • Does this answer your question? ["Does not appear to be a git repository" when trying to clone via SSH](https://stackoverflow.com/questions/56673762/does-not-appear-to-be-a-git-repository-when-trying-to-clone-via-ssh) – Benjol Dec 03 '20 at 15:55

0 Answers0