php exec git,php 通过exec 创建git分支失败

奇怪的是 分支创建成功了,但是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搭建的

600

重点回顾

git把自己的输出 放到了  STDERR not STDOUT ,所以需要重定向下,才有了如下命令git push origin pmt_20160624_v10.7.4:pmt_20160624_v10.7.4  --progress > /tmp/release.log 2>&1

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值