How can I have some debug information regarding git/git-shell?
I had a problem, that user1
could clone a repository without problem, while user2<
If its over SSH, you can use the following:
For a higher debug level for type -vv or -vvv for debug level 2 and 3 respectively:
# Debug level 1
GIT_SSH_COMMAND="ssh -v" git clone <repositoryurl>
# Debug level 2
GIT_SSH_COMMAND="ssh -vv" git clone <repositoryurl>
# Debug level 3
GIT_SSH_COMMAND="ssh -vvv" git clone <repositoryurl>
This is mainly useful to handle public and private key problems with the server. You can use this command for any git command, not only 'git clone'.
Git has a fairly complete set of traces embedded which you can use to debug your git problems.
To turn them on, you can define the following variables:
GIT_TRACE
for general traces,GIT_TRACE_PACK_ACCESS
for tracing of packfile access,GIT_TRACE_PACKET
for packet-level tracing for network operations,GIT_TRACE_PERFORMANCE
for logging the performance data,GIT_TRACE_SETUP
for information about discovering the repository and environment it’s interacting with,GIT_MERGE_VERBOSITY
for debugging recursive merge strategy (values: 0-5),GIT_CURL_VERBOSE
for logging all curl messages (equivalent to curl -v
),GIT_TRACE_SHALLOW
for debugging fetching/cloning of shallow repositories.Possible values can include:
true
, 1
or 2
to write to stderr,/
to trace output to the specified file.For more details, see: Git Internals - Environment Variables
For SSH issues, try the following commands:
echo 'ssh -vvv "$*"' > ssh && chmod +x ssh
GIT_SSH="$PWD/ssh" git pull origin master
or use ssh
to validate your credentials, e.g.
ssh -vvvT git@github.com
or over HTTPS port:
ssh -vvvT -p 443 git@ssh.github.com
Note: Reduce number of -v
to reduce the verbosity level.
$ GIT_TRACE=1 git status
20:11:39.565701 git.c:350 trace: built-in: git 'status'
$ GIT_TRACE_PERFORMANCE=$PWD/gc.log git gc
Counting objects: 143760, done.
...
$ head gc.log
20:12:37.214410 trace.c:420 performance: 0.090286000 s: git command: 'git' 'pack-refs' '--all' '--prune'
20:12:37.378101 trace.c:420 performance: 0.156971000 s: git command: 'git' 'reflog' 'expire' '--all'
...
$ GIT_TRACE_PACKET=true git pull origin master
20:16:53.062183 pkt-line.c:80 packet: fetch< 93eb028c6b2f8b1d694d1173a4ddf32b48e371ce HEAD\0multi_ack thin-pack side-band side-band-64k ofs-delta shallow no-progress include-tag multi_ack_detailed symref=HEAD:refs/heads/master agent=git/2:2.6.5~update-ref-initial-update-1494-g76b680d
...