git 报错 .git/hooks/: No such file or directory

1 git push 报错

git push origin HEAD:refs/for/*****
枚举对象中: 11, 完成.
对象计数中: 100% (11/11), 完成.
使用 16 个线程进行压缩
压缩对象中: 100% (5/5), 完成.
写入对象中: 100% (6/6), 571 字节 | 571.00 KiB/s, 完成.
总共 6(差异 3),复用 0(差异 0),包复用 0
remote: Resolving deltas: 100% (3/3)
remote: Processing changes: refs: 1, done    
remote: ERROR: missing Change-Id in commit message footer
remote: 
remote: Hint: To automatically insert Change-Id, install the hook:
remote:   gitdir=$(git rev-parse --git-dir); scp -p -P 29418 ***@gerrit.***.com:hooks/commit-msg ${gitdir}/hooks/
remote: And then amend the commit:
remote:   git commit --amend
remote: 
To ssh://gerrit.***.com:29418/platform/***

2 执行提示命令继续报错

gitdir=$(git rev-parse --git-dir); scp -p -P 29418 yeliang1@gerrit.***.com:hooks/commit-msg ${gitdir}/hooks/
.git/hooks/: No such file or directory

3 解决方式
执行

git init

然后在执行

gitdir=$(git rev-parse --git-dir); scp -p -P 29418 yeliang1@gerrit.***.com:hooks/commit-msg ${gitdir}/hooks/

再执行

git commit --amend

3 补充

如果从一开始就没有hooks文件夹,可以把项目删了, 从新clone下。sourceTree克隆下来的项目默认不带这个hooks,使用git命令克隆下来的就可以。

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值