场景
    使用php 写了一段git 同步代码的脚本 ,直接使用git pull,正常,没有错误,使用脚本同步出现两个错误

1:commands sometime before your next pull:

  git config pull.rebase false  # merge (the default strategy)
  git config pull.rebase true   # rebase
  git config pull.ff only       # fast-forward only


2:fatal: could not read Username for 'https://gitee.com': No such device or address


解决方案

1:第一个问题,执行命令 git config pull.rebase true ,再次git pull 正常


2:修改项目目录下的  .git/config文件内容
[remote "origin"]
    url = https://gitee.com/xxx/yyyy.git

 

[remote "origin"]
    url = https://登录的用户名(用的手机号登录的):登录的密码@gitee.com/xxx/yyyy.git


重新执行一下同步的php脚本,执行成功

3:有些使用 www或者其他非root用户执行的脚本,会提示没有权限,如图:

解决方法:给添加个 777权限  chmod  -R 777  你的  .git目录

4:其他:

测试是否有效果,可以使用命令测试一下,例如,运行我的php脚本是www用户,以www用户身份运行:

su www -s /bin/bash -c ' cd /www/wwwroot/haircutapp && git pull'

提示成功,成功提示:

如果还有问题提示错误,如图:

错误提示:

 

 

Logo

瓜分20万奖金 获得内推名额 丰厚实物奖励 易参与易上手

更多推荐