How to get the SSH url of a git repo on Windows?

94 Views Asked by At

I created a git repo on Windows Server machine, let's call it remote_server, using:

cd C:\Users\me\myapp
git init --bare myapp.git

After that, the myapp folder contains the myapp.git folder.

Then from my local_desktop, running Windows 11, I want to push to the remote_server:

cd D:\myapp
git remote add server ssh://me@remote_server/C/Users/me/myapp/myapp.git
git push server main

But I am getting this error:

fatal: ''/C/Users/me/myapp/myapp.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.

I have tried different SSH URLs for the remote repo:

git remote add server ssh://me@remote_server/C/Users/me/myapp
git remote add server ssh://me@remote_server/C:/Users/me/myapp/myapp.git
git remote add server ssh://me@remote_server/C:/Users/me/myapp

I got the same error.

Please help me find the right SSH URL.

1

There are 1 best solutions below

0
acmoune On

I got the way forward from this Answer.

After changing the default Windows OpenSSH shell to bash, I was able to run this successfully:

git remote add server ssh://me@remote_server/C/Users/me/myapp/myapp.git
git push server main