git描述失败,并显示“致命的:未找到名称,无法描述任何内容”。 [英] git describe fails with "fatal: No names found, cannot describe anything."
问题描述
我在Ubuntu 10.10 amd64上使用git 1.7.1,我试图提取我的仓库HEAD的散列,以便在编译到我的项目中的自动版本信息中使用它。
过去,这一直使用
git describe --tags
然而,git现在正在抛出
致命:找不到名字,无法描述任何内容。
at me。有人知道这意味着什么吗?
Google只展示了几次点击,并没有解决方案。
如果你想要你的 HEAD
的id,那么你不需要 describe
,你应该使用 rev-parse
。
git rev-parse HEAD
如果您想使用缩写哈希,您可以使用 - short
git rev-parse --short HEAD
pre>
如果您希望如果找不到任何合适的标记时使用describe回退到缩写哈希,您可以使用
-
git describe --always
I'm using git 1.7.1 on Ubuntu 10.10 amd64, and I'm trying to extract the hash of my repository HEAD to use it in an automated version information that I compile into my project.
In the past, this always worked by using
git describe --tags
however, git is now throwing
fatal: No names found, cannot describe anything.
at me. Does anyone have a clue what that means?
Google showed only few hits and no solution.
解决方案If you want the id of your
HEAD
then you don't needdescribe
, you should just userev-parse
.git rev-parse HEAD
If you want an abbreviated hash you can use
--short
.git rev-parse --short HEAD
If you want a "describe" to fall back to an abbreviated hash if it can't find any suitable tags, you can use
--always
.git describe --always
这篇关于git描述失败,并显示“致命的:未找到名称,无法描述任何内容”。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!