远程命令给出不同的输出(权限被拒绝)

远程命令给出不同的输出(权限被拒绝)

当我连接到远程服务器并执行命令时

git ls-remote [email protected]:repo/repo.git HEAD

它工作正常。但是当我尝试从本地机器执行它时

ssh [email protected] git ls-remote [email protected]:repo/repo.git HEAD

它给出了错误:

[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.

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

有人能告诉我为什么会发生这种情况吗?尝试重新启动 ssh-agent,但没有帮助。

相关内容