macOS – How to Determine What is Hanging Git

gitmacos

I'm trying to do a git pull on my Mac from a local repo. It is hanging. My question is, why is it hanging and how can I stop it? That is, I'm in a repo where the "remotes" are on the local filesystem:

rcook@mymachine (paraDIS_lib (master)): git remote -v
origin  /Users/rcook/gitrepos/paraDIS_lib (fetch)
origin  /Users/rcook/gitrepos/paraDIS_lib (push)

And if I do a git pull then it just hangs, no progress, nothing. It seems to be stuck doing something called "git-upload-pack":

rcook@RichCookHomeMac (~ (BARE:master)): psfind git
root            15840     1   0.0  0.0 git              git fetch
rcook           23160 22699   0.0  0.0 git              git pull -v --progress
rcook           23161 23160   0.0  0.0 git              git fetch --update-head-ok -v --progress
rcook           23162 23161   0.0  0.0 git-upload-pack  git-upload-pack /Users/rcook/gitrepos/paraDIS_lib

And if run with GIT_TRACE, it looks like I'm hung on "git rev-list":

rcook@RichCookHomeMac (paraDIS_lib.local (master)):    GIT_TRACE=1 git pull
16:51:50.002029 git.c:348               trace: built-in: git 'pull'
16:51:50.002479 run-command.c:335       trace: run_command: 'fetch' '--update-head-ok'
16:51:50.003491 exec_cmd.c:128          trace: exec: 'git' 'fetch' '--update-head-ok'
16:51:50.016960 git.c:348               trace: built-in: git 'fetch' '--update-head-ok'
16:51:50.017949 run-command.c:335       trace: run_command: 'git-upload-pack '\''/Users/rcook/gitrepos/paraDIS_lib'\'''
16:51:50.018872 run-command.c:195       trace: exec: '/bin/sh' '-c' 'git-upload-pack '\''/Users/rcook/gitrepos/paraDIS_lib'\''' 'git-upload-pack '\''/Users/rcook/gitrepos/paraDIS_lib'\'''
16:51:50.038192 run-command.c:335       trace: run_command: 'rev-list' '--objects' '--stdin' '--not' '--all' '--quiet'

Indeed, I can induce a hang with:

GIT_TRACE=1 git rev-list --objects --stdin --not --all

Pulling from the same repo but from a remote machine via ssh works fine. I.e.,

rcook@rzhasgpu18 (paraDIS_lib (master)): git remote -v
origin  mymachine.net:/Users/rcook/gitrepos/paraDIS_lib (fetch)
origin  mymachine.net:/Users/rcook/gitrepos/paraDIS_lib (push)

There, git pull works great, although it's still very slow.

My question is, shouldn't the local version be way way faster? How can I figure out what is slowing this down? On linux, I would run it under strace, but on OS X this is very hard to do it seems, especially in El Capitan with all its weird security stuff.

Best Answer

Yep, occasionally this happens for me too. But it goes normal once I reboot my machine. Probably it starts to happen after update to git version 2.7.2.