奇怪的是 分支创建成功了,但是push 去没有成功,打印出来的内容也没有提示什么错误,排除了半天没查到原因
开始我在$cmd中加了一个调试命令,ssh git@xxxxx,我是怀疑没有加入ssh key 导致的$ ssh git@xxxxx
PTY allocation request failed on channel 0
Welcome to GitLab, vincent!
Connection to xxxxx closed.
但是通过php执行exec执行出来的命令提示是Welcome to GitLab, robot!
发现 是不同的用户,一个是vincent,一个是robot,其实这个时候如果比较敏感的就知道什么问题了,后来我也是想到这点才解决的
后来我想办法将 push的命令提示打印出来了git push origin pmt_20160624_v10.7.4:pmt_20160624_v10.7.4 --progress > /tmp/release.log 2>&1
提示错误信息如下GitLab: You are not allowed to push code to this project.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
我猛然想起来了,我是没有给robot账号 权限哇,我们git使用gitlab搭建的
重点回顾
git把自己的输出 放到了 STDERR not STDOUT ,所以需要重定向下,才有了如下命令git push origin pmt_20160624_v10.7.4:pmt_20160624_v10.7.4 --progress > /tmp/release.log 2>&1