开发过程中遇到Git提交代码经常遇到该问题,尝试了网上各种方式,均无效,最后结合前辈们的经验,总算研究出一种方法,可治该病:
1、git config remote.origin.push refs/heads/*:refs/for/*
2、gitdir=$(git rev-parse --git-dir); scp -p -P 29418 yourEmail@email.com:hooks/commit-msg ${gitdir}/hooks/
3、git commit --amend
4、git push origin yourBranch
注意:
上面的branch是你的分支名,自行替换
第二步中间的邮箱为你自己的git邮箱地址,注意替换