Using strace to figure out how Git push over SSH works
kamalmarhubi.com
kamalmarhubi.com
But sometimes you have to roll up your sleeves and read the source. I also found the git mailing list to be pretty helpful.
I tend to keep a copy of glibc, Python, coreutils, openssl, and binutils laying around for random grep'ing. I also sometimes keep other more specific tools and libraries laying around, depending on what I'm working on. And, of course, whatever code you use at your place of work.
If you want to have some fun, strace strace to see how it works. Or strace lsof, or ps, or df, or other tools that inspect the state of your system.
In the source code you are looking at layers over layers of abstraction, variables being passed around and mangled and substituted into strings, maybe get into a dependency tree of various libraries.
Not to say that you are wrong, the source the ultimate most powerful tool and absolutely you should learn to use it. But I disagree with what tool to use first, if you have zero knowledge about the process.
Though from a learning perspective, it might be useful to play with something like git using strace then compare with what you find in the code. This could help you learn how to interpret results when you don't have access to the code when diagnosing something else later.
Here's my favourite hack: https://chris-lamb.co.uk/posts/can-you-get-cp-to-give-a-prog...
Still, a very good way to get started with understanding what strace is doing ..
This signal does not exist on Linux.
But the strace-cp-progress hack is an interesting snippet for understanding some of the things you can do with strace.
rsync --info=progress2 --no-inc-recursive
...and see total transfer progress. This requires rsync to do a full recursive scan before beginning the transfer, but sometimes it's worth it.
tar -zc /somedir/ | ssh remotebox tar -xzC /somedir/
(you can play with -z vs ssh -C, but my experience is that -z is faster because it compresses before passing across the wire; don't do both, though..)
I've also had really great luck doing this on a single filesystem (tar into tar), since it does a better job with things like /dev compared to cp.
rsync has a lot of other awesomeness, though, especially with its hard-link capabilities. That can save a huge amount of space on remote backups over multiple days. (We use glacier for backups at Userify (ssh key management), but we also use this trick for remote pull backup to the backups without server access.)
tar -zc /somedir/ | pv | ssh remotebox tar -xzC /somedir/
That won't give a % done as it won't know the total size, but if you scan the source first and split out the tar and compress stages you can achieve that though it'll be a little less efficient: tar -c somedir | pv --size `du somedir -bs | cut -f1` | ssh -C remotebox tar -xC /tmp/
and if you want to keep the compression via gzip instead of ssh (I'm not sure that'll make any difference myself as ssh IIRC uses the same algorithm, though I've not benchmarked it at all): tar -c somedir | pv --size `du somedir -bs | cut -f1` | gzip | ssh remotebox tar -xzC /somedir/I believe this is the commit which made that change, very early in Git's history:
http://article.gmane.org/gmane.comp.version-control.git/1405...