How do we specify git repo path in Windows 10?
I would like to sync the git repositories between a local Mac/Linux machine with a remote Windows 10. Due to the safety and security concern, I am not allow to directly use git and SSH-key to connect to the Windows. I need to build an SSH connection with ProxyCommand and apply SSH port forwarding before calling git.
The port forwarding works fine
ssh -o ProxyCommand="JumperServer %h %p" -L 1922:localhost:22 username@$IP -N
git push -f "ssh://User@[localhost:1922]C/Users/User/Desktop/git_repo_dir"
My problem is the above line returns me the following error
The authenticity of host '[localhost]:1922 ([::1]:1922)' can't be established.
ED25519 key fingerprint is SHA256:vjA1nhxr9wGUEm53EA3JU4OfNJ04Co+Q1UCf2fb0q2g.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '[localhost]:1922' (ED25519) to the list of known hosts.
User@localhost's password:
'git-receive-pack' ���O�����Υ~���R�O�B�i��檺�{���Χ妸�ɡC
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
I suspect the error is due to the wrong repo path syntax. I had several tries such as following but all of them return me identical error as the above.
- git -C . push -f 'ssh://User@localhost:1922/C:\Users\User\Desktop\git_repo_dir'
- git -C . push -f 'ssh://User@localhost:1922/c:\Users\User\Desktop\git_repo_dir'
- git -C . push -f ssh://User@localhost:1922/C/Users/User/Desktop/git_repo_dir
- git -C . push -f 'ssh://User@[localhost:1922]c/Users/User/Desktop/git_repo_dir/
The whole code works when my remote machine is a Mac. This leads me believe my problem is due to Windows path syntax. I'm not sure about the garbled code in the error message. The same garbled code appears both on my local Mac and Linux.
How do I solve this issue?
Thank you