如何在Windows 10中指定git回购路径?
我想同步本地Mac/Linux机器与远程Windows 10之间的git存储库。出于安全和安全考虑,我不允许直接使用git和SSH键连接到Windows。我需要用ProxyCommand构建一个SSH连接,并在调用git之前应用SSH端口转发。
港口运输工作正常。
ssh -o ProxyCommand="JumperServer %h %p" -L 1922:localhost:22 username@$IP -Ngit push -f "ssh://User@[localhost:1922]C/Users/User/Desktop/git_repo_dir"我的问题是,上面的行返回了以下错误
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.我怀疑错误是由于错误的回购路径语法。我做了几次尝试,如以下所示,但它们都返回了与上述相同的错误。
当我的远程机器是Mac时,整个代码都能工作。这使我相信,我的问题是由于Windows路径语法。我不确定错误消息中的错误代码。同样的乱码出现在我的本地Mac和Linux上。
我该如何解决这个问题?
谢谢
发布于 2022-04-27 07:03:20
第一个测试是检查常规的SSH ls命令是否有效。
语法应该是:
ssh User@[localhost:1922]/c/Users/User/Desktop/git_repo_dir一旦成功,您就可以尝试git push了。
https://stackoverflow.com/questions/72022816
复制相似问题