/.git/hooks/: No such file or directory protocol error: expected control record on Mac osx

廉价感情. 提交于 2019-12-08 07:09:01

问题


Stumbled across this error today to waste a good amount of time, while trying to have gerrit hook setup for a repository, was using the following command scp -p -P 29418 tttt@tttt.ttt.com:hooks/commit-msg .git/hooks/ on terminal after having checked-out the project via XCode

Two reasons for this are:

  1. Executing hook command on incorrect folder. Makes sure to execute this command on parent folder of the checked-out folder & not on checked-out folder.
  2. Executing hook on a different branch other than on the master branch. Make sure to run the hook command on the master branch, before switching/checking-out a different branch.

回答1:


Make sure that you are trying to install the hook from the correct folder, which is the root folder of the repository (which contains the .git folder)

In my case, I have cloned the repo using SourceTree, which omitted putting the repo inside a root folder. So, there were a bunch of files inside a folder that I have manually created on Finder.

To fix it, I re-cloned the project through the terminal, it puts the files inside a root folder with the name of the project; then everything worked fine.



来源:https://stackoverflow.com/questions/31854122/git-hooks-no-such-file-or-directory-protocol-error-expected-control-record

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!