git私有仓库搭建过程中常遇到的错误
首先自动发布的勾子有多个写法,每个人的分支不一样也不一样。
#!/bin/sh depot=/var/gitdepot/xcwmoon.git unset GIT_DIR cd /home/xcw/xcwmoon git reset --hard #这个会抛弃本地修改 并且无法找回 git pull origin master echo '+++++++success++++++++++++++++'
#!/bin/sh depot=/var/gitdepot/www.xcwmoon.com.git www=/home/xcw/xcwmoon.com unset GIT_DIR cd $www git fetch --all git reset --hard origin/master time=`date` echo "++++++success $time+++++++++"
错误1:hooks/post-receive: line 5: cd: /home/xcw/xcwmoon: Not a directory
这个错误一般会出现在你将这个路径定义成变量 例如 project=/home/xcw/xcwmoon cd $project 可能会报这个错
错误 2:git Permission denied, please try again.Please, commit your changes or stash them before you can merge.
如果报这个错,你可以把它抛弃掉就是添加 git reset --hard 命令。
错误3:fatal: /usr/libexec/git-core/git-pull cannot be used without a working tree.
这个错误是因为没有工作目录,去把同步的工作目录建立好(克隆一下子)
错误4:fatal: This operation must be run in a work tree
这个错误一般会与错误3或错误1同时出现 就是它没有工作树,就是发布的目录找不到也会报这个。
错误5:error: cannot open .git/FETCH_HEAD: Permission denied
这个错误就是没有权限 带'Permission denied'字样的 都是没有权限,这就包括了权限不足或者目录文件不存在等。
最后在hooks目录中会有一个.log后缀的日志文件,具体问题可以自己打开看一下。
留言(0)