git git中的“项目描述文件”错误?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/200213/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
"Project description file" error in git?
提问by Paul Wicks
I've a small project that I want to share with a few others on a machine that we all have access to. I created a bare copy of the local repo with
我有一个小项目,我想在我们都可以访问的机器上与其他一些人共享。我创建了本地存储库的裸副本
git clone --bare --no-hardlinks path/to/.git/ repoToShare.git
I then moved repoToShare.git to the server.
然后我将 repoToShare.git 移动到服务器。
I can check it out with the following:
我可以通过以下方式检查:
git clone ssh://user@address/opt/gitroot/repoToShare.git/ test
I can then see everything in the local repo and make commits against that. When I try to push changes back to the remote server I get the following error.
然后我可以看到本地存储库中的所有内容并对此进行提交。当我尝试将更改推送回远程服务器时,出现以下错误。
*** Project description file hasn't been set
error: hooks/update exited with error code 1
error: hook declined to update refs/heads/master
Any ideas?
有任何想法吗?
回答by MDCore
Git installs a bunch of pre-configured hooks in the hooks directory, out of the box they do not execute. If you happen to allow execute on them (Eg. chmod +x) then git will try to run them. The particular error pops up cause the default update is failing to run. To fix, delete the default update hook.
Git 在 hooks 目录中安装了一堆预配置的钩子,开箱即用,它们不执行。如果您碰巧允许对它们执行(例如 chmod +x),那么 git 将尝试运行它们。弹出的特定错误导致默认更新无法运行。要修复,请删除默认更新挂钩。
Does this linkhelp? From the text:
请问此链接帮助?从文中:
A colleague of mine experienced a similar issue here where push was not working. You could not push to a local or remote public repository. He was getting a project description file hasn't been set error thrown by .git/hooks/update. This error was not happening for the same project on a linux or Windows box, and seemed to be happening only on Windows Vista. From my research hooks/update is not by default executed, but in windows vista the file permissions meant that it was. Deletion of hooks/update resolved these issues.
我的一位同事在这里遇到了类似的问题,其中推送不起作用。您无法推送到本地或远程公共存储库。他收到了 .git/hooks/update 抛出的项目描述文件尚未设置错误。对于 linux 或 Windows 机器上的同一个项目,此错误没有发生,而且似乎只发生在 Windows Vista 上。从我的研究来看,钩子/更新不是默认执行的,但在 windows vista 中,文件权限意味着它是。删除钩子/更新解决了这些问题。
回答by MDCore
Deleting hooks/update is not what you want to do.
删除钩子/更新不是您想要做的。
Just change .git/description to whatever you want - for instance "FOOBAR repository", or, if you are French, "Le depot de FOOBAR".
只需将 .git/description 更改为您想要的任何内容 - 例如“FOOBAR 存储库”,或者,如果您是法国人,则为“Le depot de FOOBAR”。
回答by Paul Wicks
I got this error as well when pushing from Mac OS X (Git version 1.6.1, compiled with MacPorts) to an Ubuntu remote repository (Git version 1.5.4.3)
从 Mac OS X(Git 版本 1.6.1,使用MacPorts编译)推送到 Ubuntu 远程存储库(Git 版本 1.5.4.3)时,我也遇到了这个错误
I've added the name of repository in the .git/description file on both the local and remote repository and that fixed it.
我已经.git在本地和远程存储库的/description 文件中添加了存储库的名称并修复了它。
回答by ppetrid
chmod -x hooks/update
chmod -x 钩子/更新
the above command executed from your .git directory will only remove execute permissions from the update hook. No need to delete the file
从 .git 目录执行的上述命令只会从更新挂钩中删除执行权限。不需要删除文件
回答by rodrigomanhaes
Delete file or prevent its execution seem extreme solutions. If you don't want to add a project description, it's enough comment or delete the lines in hooks/update that are blocking the push actions. In my file, these lines are:
删除文件或阻止其执行似乎是极端的解决方案。如果您不想添加项目描述,只需注释或删除 hooks/update 中阻止推送操作的行即可。在我的文件中,这些行是:
# check for no description
projectdesc=$(sed -e '1q' "$GIT_DIR/description")
if [ -z "$projectdesc" -o "$projectdesc" = "Unnamed repository; edit this file to name it for gitweb." ]; then
echo "*** Project description file hasn't been set" >&2
exit 1
fi
When I commented them out, everything worked fine.
当我将它们注释掉时,一切正常。
回答by Dominic Webb
I had the same issue as @dragulesq but with a Red Hatserver.
我遇到了与@dragulesq 相同的问题,但使用的是Red Hat服务器。
To be a bit more verbose just put whatever you want as a string in the .git/description file on your local (in my case my Mac OS X); I put websiteand then on the remote server that hosts the Git repo (as so to speak) edit the .git/description file and put the same string in again (e.g. website).
更详细一点,只需将您想要的任何内容作为字符串放在本地的 .git/description 文件中(在我的情况下是我的 Mac OS X);我把网站放在托管 Git 存储库的远程服务器上(可以这么说)编辑 .git/description 文件并再次放入相同的字符串(例如website)。

