Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable debug/verbose logging to diagnose failures of fetching the repository #1713

Open
matusnovak opened this issue May 2, 2024 · 1 comment

Comments

@matusnovak
Copy link

I have a problem that in my private repo the fetching step fails, but I could not find any way to diagnose the problem.

Such output looks like this:

Fetching the repository
  /usr/bin/git -c protocol.version=2 fetch --no-tags --prune --no-recurse-submodules --depth=1 origin +refs/heads/403/merge*:refs/remotes/origin/403/merge* +refs/tags/403/merge*:refs/tags/403/merge*
  The process '/usr/bin/git' failed with exit code 1
  Waiting 20 seconds before trying again
  /usr/bin/git -c protocol.version=2 fetch --no-tags --prune --no-recurse-submodules --depth=1 origin +refs/heads/403/merge*:refs/remotes/origin/403/merge* +refs/tags/403/merge*:refs/tags/403/merge*
  The process '/usr/bin/git' failed with exit code 1
  Waiting 11 seconds before trying again
  /usr/bin/git -c protocol.version=2 fetch --no-tags --prune --no-recurse-submodules --depth=1 origin +refs/heads/403/merge*:refs/remotes/origin/403/merge* +refs/tags/403/merge*:refs/tags/403/merge*
Error: The process '/usr/bin/git' failed with exit code 1

Which is not helpful.

Is there any way how I can enable debug or verbose logging for actions/checkout, so that I could diagnose the problem on why the git command failed?

@andrewgxp
Copy link

Hi @matusnovak! You can enable robust Git logging within your workflow by adding the GIT_CURL_VERBOSE, GIT_TRACE, GIT_SSH_COMMAND variables to your environment.

This can be done in your workflows via env:

This example works on Linux and MacOS based runners:

name: Workflow with Git debugging enabled

on:
  workflow_dispatch:

env:
  GIT_CURL_VERBOSE: True
  GIT_TRACE: True
  GIT_SSH_COMMAND: ssh -vvv

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0

Once you check your workflow logs, you'll then see more robust outputs similar to this:

/usr/bin/git -c protocol.version=2 fetch --prune --progress --no-recurse-submodules origin +refs/heads/*:refs/remotes/origin/* +refs/tags/*:refs/tags/*
  16:45:49.536540 git.c:472               trace: built-in: git fetch --prune --progress --no-recurse-submodules origin '+refs/heads/*:refs/remotes/origin/*' '+refs/tags/*:refs/tags/*'
  16:45:49.537350 run-command.c:666       trace: run_command: GIT_DIR=.git git remote-https origin https://github.com/example-owner/example-repo
  16:45:49.537445 run-command.c:758       trace: start_command: /usr/lib/git-core/git remote-https origin https://github.com/example-owner/example-repo
  16:45:49.539345 git.c:758               trace: exec: git-remote-https origin https://github.com/example-owner/example-repo
  16:45:49.539489 run-command.c:666       trace: run_command: git-remote-https origin https://github.com/example-owner/example-repo
  16:45:49.539610 run-command.c:758       trace: start_command: /usr/lib/git-core/git-remote-https origin https://github.com/example-owner/example-repo
  16:45:49.551813 http.c:912              == Info: Couldn't find host github.com in the (nil) file; using defaults
  16:45:49.573305 http.c:912              == Info:   Trying 140.82.112.3:443...
  16:45:49.579139 http.c:912              == Info: Connected to github.com (140.82.112.3) port 443 (#0)
  16:45:49.616535 http.c:912              == Info: found 413 certificates in /etc/ssl/certs
  16:45:49.616997 http.c:912              == Info: GnuTLS ciphers: NORMAL:-ARCFOUR-128:-CTYPE-ALL:+CTYPE-X509:-VERS-SSL3.0
  16:45:49.617033 http.c:912              == Info: ALPN, offering h2
  16:45:49.617039 http.c:912              == Info: ALPN, offering http/1.1
  16:45:49.625640 http.c:912              == Info: SSL connection using TLS1.3 / ECDHE_RSA_AES_128_GCM_SHA256
  16:45:49.627965 http.c:912              == Info:   server certificate verification OK
  16:45:49.627977 http.c:912              == Info:   server certificate status verification SKIPPED
  16:45:49.628073 http.c:912              == Info:   common name: github.com (matched)
  16:45:49.628093 http.c:912              == Info:   server certificate expiration date OK
  16:45:49.628100 http.c:912              == Info:   server certificate activation date OK
  16:45:49.628114 http.c:912              == Info:   certificate public key: EC/ECDSA
  16:45:49.628119 http.c:912              == Info:   certificate version: #3
  16:45:49.628132 http.c:912              == Info:   subject: CN=github.com
  16:45:49.628140 http.c:912              == Info:   start date: Thu, 07 Mar 2024 00:00:00 GMT
  16:45:49.628147 http.c:912              == Info:   expire date: Fri, 07 Mar 2025 23:59:59 GMT
  16:45:49.628177 http.c:912              == Info:   issuer: C=GB,ST=Greater Manchester,L=Salford,O=Sectigo Limited,CN=Sectigo ECC Domain Validation Secure Server CA

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants