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 ?