Search code examples
gitcocoapodsrepo

pod repo update failed: Cannot do hard reset with paths


When I'm running

proxychains4 pod repo update

I got the following output

[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`

However, if I run git manually

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

Everything works well.

I have to use proxychains to connect github.

I'm running cocoapods version 1.2.0/git version 2.7.0.


Solution

  • It looks like proxychains's commandline output somehow mixed in the cocoapods's script.

    Add -q option to make proxychains run quietly fixes this problem.

    proxychains4 -q pod repo update