git中的“项目描述文件”错误?

时间:2023-02-05 17:47:26

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?

6 个解决方案

#1


19  

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 link help? 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中,文件权限意味着它。删除钩子/更新解决了这些问题。

#2


16  

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 repository”,或者,如果您是法语,则“Le depot de FOOBAR”。

#3


2  

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文件中添加了存储库的名称并修复了它。

#4


1  

chmod -x hooks/update

chmod -x hooks / update

the above command executed from your .git directory will only remove execute permissions from the update hook. No need to delete the file

从.git目录执行的上述命令只会从更新挂钩中删除执行权限。无需删除文件

#5


1  

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:

删除文件或阻止其执行似乎极端的解决方案。如果您不想添加项目描述,则足以评论或删除阻止推送操作的挂钩/更新中的行。在我的文件中,这些行是:

# 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.

当我评论它们时,一切都很好。

#6


0  

I had the same issue as @dragulesq but with a Red Hat server.

我和@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 website and 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文件并再次输入相同的字符串(例如网站)。

#1


19  

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 link help? 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中,文件权限意味着它。删除钩子/更新解决了这些问题。

#2


16  

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 repository”,或者,如果您是法语,则“Le depot de FOOBAR”。

#3


2  

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文件中添加了存储库的名称并修复了它。

#4


1  

chmod -x hooks/update

chmod -x hooks / update

the above command executed from your .git directory will only remove execute permissions from the update hook. No need to delete the file

从.git目录执行的上述命令只会从更新挂钩中删除执行权限。无需删除文件

#5


1  

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:

删除文件或阻止其执行似乎极端的解决方案。如果您不想添加项目描述,则足以评论或删除阻止推送操作的挂钩/更新中的行。在我的文件中,这些行是:

# 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.

当我评论它们时,一切都很好。

#6


0  

I had the same issue as @dragulesq but with a Red Hat server.

我和@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 website and 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文件并再次输入相同的字符串(例如网站)。