V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
git
Pro Git
Atlassian Git Tutorial
Pro Git 简体中文翻译
GitX
xi_lin
V2EX  ›  git

pod repo update 失败提示 Cannot do hard reset with paths

  •  
  •   xi_lin · 2017-04-01 11:21:29 +08:00 · 5822 次点击
    这是一个创建于 2576 天前的主题,其中的信息可能已经有所发展或是发生改变。

    执行的命令是

    proxychains4 pod repo update
    

    输出是

    [proxychains] config file found: /usr/local/Cellar/proxychains-ng/4.10/etc/proxychains.conf
    [proxychains] preloading /usr/local/Cellar/proxychains-ng/4.10/lib/libproxychains4.dylib
    [proxychains] DLL init: proxychains-ng 4.10
    [proxychains] DLL init: proxychains-ng 4.10
    [proxychains] DLL init: proxychains-ng 4.10
    [proxychains] DLL init: proxychains-ng 4.10
    [proxychains] DLL init: proxychains-ng 4.10
    [proxychains] DLL init: proxychains-ng 4.10
    Updating spec repo `master`
    [proxychains] DLL init: proxychains-ng 4.10
    [proxychains] DLL init: proxychains-ng 4.10
    [proxychains] Strict chain  ...  127.0.0.1:1080  ...  api.github.com:443  ...  OK
    [proxychains] DLL init: proxychains-ng 4.10
    [proxychains] DLL init: proxychains-ng 4.10
      $ /usr/local/bin/git -C /Users/linxi/.cocoapods/repos/master fetch origin
      [proxychains] DLL init: proxychains-ng 4.10
      [proxychains] DLL init: proxychains-ng 4.10
      [proxychains] Strict chain  ...  127.0.0.1:1080  ...  github.com:443  ...  OK
      [proxychains] DLL init: proxychains-ng 4.10
      [proxychains] DLL init: proxychains-ng 4.10
      [proxychains] DLL init: proxychains-ng 4.10
      From https://github.com/CocoaPods/Specs
         1eaabbe..7cc75a2  master     -> origin/master
      [proxychains] DLL init: proxychains-ng 4.10
      $ /usr/local/bin/git -C /Users/linxi/.cocoapods/repos/master rev-parse --abbrev-ref HEAD
      [proxychains] DLL init: proxychains-ng 4.10
      master
      $ /usr/local/bin/git -C /Users/linxi/.cocoapods/repos/master reset --hard origin/master [proxychains] DLL init: proxychains-ng 4.10
      [proxychains] DLL init: proxychains-ng 4.10
      fatal: Cannot do hard reset with paths.
    [!] CocoaPods was not able to update the `master` repo. If this is an unexpected issue and persists you can inspect it running `pod repo update --verbose`
    

    直接手动执行

    proxychains4 /usr/local/bin/git -C /Users/linxi/.cocoapods/repos/master reset --hard origin/master
    

    又是可以的

    cocoapods version 1.2.0/git version 2.7.0

    会是因为啥呢?

    第 1 条附言  ·  2017-04-24 10:16:21 +08:00
    见这个回答
    http://stackoverflow.com/a/43558091/535374

    proxychain 的输出被当作 git 参数了
    8 条回复    2017-04-24 12:23:45 +08:00
    mornlight
        1
    mornlight  
       2017-04-01 12:24:59 +08:00
    you can inspect it running `pod repo update --verbose`
    xi_lin
        2
    xi_lin  
    OP
       2017-04-01 12:38:33 +08:00
    @mornlight 跑 verbose 效果一样的,连输出都一样
    mornlight
        3
    mornlight  
       2017-04-01 12:50:45 +08:00
    @xi_lin #2 没遇到过这种情况。如果只是想解决问题,把本地 pod 缓存的 repos 删掉然后全部重新拉一边试试。
    xi_lin
        4
    xi_lin  
    OP
       2017-04-01 14:19:50 +08:00
    @mornlight 试过删除重拉了,还是一样。。
    我另一台 mac 就不会报错,也不知道是为啥
    mornlight
        5
    mornlight  
       2017-04-01 14:26:18 +08:00
    @xi_lin #4
    rm -rf "${HOME}/Library/Caches/CocoaPods"

    不行的话我也想不明白了, pod 更新跟 pull 一个 repo 一样的,还能出啥问题。
    xi_lin
        6
    xi_lin  
    OP
       2017-04-01 14:44:21 +08:00
    @mornlight 还是不行
    我也觉得,就是个 reset ,而且手动跑 reset 也是行的
    xi_lin
        7
    xi_lin  
    OP
       2017-04-24 10:15:40 +08:00
    @mornlight 原来是 proxychain-ng 的输出被当成 git 命令的参数了,加个-q 就好了
    mornlight
        8
    mornlight  
       2017-04-24 12:23:45 +08:00
    @xi_lin #7
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2587 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 04:55 · PVG 12:55 · LAX 21:55 · JFK 00:55
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.