当您尝试获取一些信息时,可以使用ls-remote.
在您的场景中,您将执行以下命令:
git ls-remote <remote> refs/tags/v1.0.0
这将输出类似以下内容的内容:
e8b29c3c46a59dc59e2a3b22c253860c23a9ea39 refs/tags/v1.0.0
你应该能够将其改造成有用的东西:)
<remote>是您正在查询的遥控器。另一个获取 master 分支 sha 的引用的完整示例如下:
git ls-remote ssh://git@github.com/praqma-training/gitkatas refs/heads/master
与输出:
634c33168ee434a10f74e3254c3f5f548f263250 refs/heads/master。
祝你好运!