How can I debug git/git-shell related problems?

前端 未结 8 1741
说谎
说谎 2020-11-22 15:16

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<

8条回答
  •  礼貌的吻别
    2020-11-22 15:22

    For older git versions (1.8 and before)

    I could find no suitable way to enable SSH debugging in an older git and ssh versions. I looked for environment variables using ltrace -e getenv ... and couldn't find any combination of GIT_TRACE or SSH_DEBUG variables that would work.

    Instead here's a recipe to temporarily inject 'ssh -v' into the git->ssh sequence:

    $ echo '/usr/bin/ssh -v ${@}' >/tmp/ssh
    $ chmod +x /tmp/ssh
    $ PATH=/tmp:${PATH} git clone ...
    $ rm -f /tmp/ssh
    

    Here's output from git version 1.8.3 with ssh version OpenSSH_5.3p1, OpenSSL 1.0.1e-fips 11 Feb 2013 cloning a github repo:

    $ (echo '/usr/bin/ssh -v ${@}' >/tmp/ssh; chmod +x /tmp/ssh; PATH=/tmp:${PATH} \
       GIT_TRACE=1 git clone https://github.com/qneill/cliff.git; \
       rm -f /tmp/ssh) 2>&1 | tee log
    trace: built-in: git 'clone' 'https://github.com/qneill/cliff.git'
    trace: run_command: 'git-remote-https' 'origin' 'https://github.com/qneill/cliff.git'
    Cloning into 'cliff'...
    OpenSSH_5.3p1, OpenSSL 1.0.1e-fips 11 Feb 2013
    debug1: Reading configuration data /home/q.neill/.ssh/config
    debug1: Reading configuration data /etc/ssh/ssh_config
    debug1: Applying options for *
    debug1: Connecting to github.com ...
    ...
    Transferred: sent 4120, received 724232 bytes, in 0.2 seconds
    Bytes per second: sent 21590.6, received 3795287.2
    debug1: Exit status 0
    trace: run_command: 'rev-list' '--objects' '--stdin' '--not' '--all'
    trace: exec: 'git' 'rev-list' '--objects' '--stdin' '--not' '--all'
    trace: built-in: git 'rev-list' '--objects' '--stdin' '--not' '--all'
    

提交回复
热议问题