【问题标题】:Push on gerrit with windows用窗户推动 gerrit
【发布时间】:2013-07-16 18:27:14
【问题描述】:

我正在努力使用 TortoiseGit 将我的一些数据推送到 gerrit。我创建了一个新的 repo 并将其提交给 master。我用我的私钥添加了一个遥控器,还上传了公钥。

从gerrit中拉出没问题,但是当我尝试push时出现以下错误:

remote: Resolving deltas: 100% (96/96)
remote: Processing changes: refs: 1, done    
remote: ERROR: missing Change-Id in commit message
remote: Suggestion for commit message:
remote: Initial Commit
remote:
remote: Change-Id: Icb5f79b9a32abc77a99f0034ecc6a5a9ae9ef1c6
remote: Hint: To automatically add a Change-Id to commit messages, install the commit-msg hook:
remote: $ scp -p -P 29418 <server stuff>:hooks/commit-msg .git/hooks/

最大的问题是,我生活在一个 Windows 世界中,没有 $ scp .... 有什么建议,我如何安装 git hook 或提供提交 id?

顺便说一句git hooks --install 返回'hooks' is not a git command

【问题讨论】:

    标签: windows git repository gerrit


    【解决方案1】:

    只需从 @987654321@ 下载它,然后将其复制到您的 .git/hooks 文件夹中。

    或者你可以从gerrit review下载

    -- 更新--

    如果你在本地提交后添加了提交钩子,这可能是这种情况,你需要修改你的最后一次提交。只需修改最后一次提交而不进行任何实际更改,就会将 Change-ID 添加到您的日志消息中。

    1. git commit -a --amend
    2. git log -1 // 这是为了检查 Change-ID 是否存在于您的日志消息中
    3. git push origin HEAD:refs/for/master

    -- 更新 2--

    如果你和我一样,并且在创建克隆时有很多项目,那么你可能想要设置你的 git 安装,以便默认安装 commit-msg 钩子。您可以通过将 commit-msg 复制到您的 git 模板文件夹来完成此操作。在我的 Win7 系统上可以在这里找到:

    C:\Program Files (x86)\Git\share\git-core\templates\hooks

    下次创建新克隆时,无需再次下载 commit-msg。

    【讨论】:

    • 基本上你可以从你的 gerrit 安装中下载 tools/hooks 目录下的 commit-msg 脚本。因为我不知道你的 URL,所以我放了 example.com。我认为这应该可以解决您的问题。请接受答案。
    • 如果我从 gerrit-review 下载 commit-msg 并将其复制到 &lt;Project Folder&gt;\.git\hooks 它不起作用。我仍然收到相同的错误消息。
    • 啊...commit-msg 钩子是 shell 脚本...它们不能在 Windows 机器上工作
    • 他们确实在 Windows 上工作。您应该做的一件事是修改您的最后一次提交,即使没有更改。通过修改您的最后一次提交,更改 ID 将添加到您的提交消息中,之后您可以推送您的提交以供审核。只需执行以下操作: git commit -a --amend 并保存您之前的文本,然后使用 git log -1 检查是否已添加 Change-ID。
    • 在 windows10 上,我的模板文件夹位置是:c:\Program Files\Git\mingw64\share\git-core\templates\hooks\。
    【解决方案2】:

    这看起来像是适当的挂钩未下载到您的克隆中的情况。

    您可以尝试这样做:

    # cd into your clone such that you should be able to see .git folder on ls -a
    # for example if you had following structure myclone/myproject/.git
    # you have to cd to myclone/myproject directory
    
    
    $ scp -p -P 29418 <server stuff>:hooks/commit-msg .git/hooks/
    

    现在转到您的钩子文件夹并执行ls 以查看您是否已下载所需的钩子。

    您无需安装任何挂钩,只需从您的 gerrit 存储库中复制即可

    更新 https://www.mediawiki.org/wiki/Talk:Gerrit/git-review 是您可能正在寻找的东西

    【讨论】:

    • 您只需将该 commit-msg 文件复制到您的 .git/hooks 目录中。我不确定您是否有权在 Windows 机器上安装软件...但如果可以的话。 ..安装putty或者你也可以使用Win-scp...或者你可以让管理员email给你,你可以复制它
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-08-19
    • 1970-01-01
    • 1970-01-01
    • 2013-08-08
    • 1970-01-01
    相关资源
    最近更新 更多