[GH-ISSUE #5244] Git commands following actions/checkout@v4 fail with the error: fatal: could not read Username for 'https:/myghinstance': terminal prompts disabled #1266

Closed
opened 2026-03-01 21:50:02 +03:00 by kerem · 1 comment
Owner

Originally created by @PavelKa on GitHub (Jun 9, 2025).
Original GitHub issue: https://github.com/nektos/act/issues/5244

Bug report info

act version:            0.2.76
GOOS:                   linux
GOARCH:                 amd64
NumCPU:                 8
Docker host:            DOCKER_HOST environment variable is not set
Sockets found:
        /var/run/docker.sock
Config files:           
        /home/ec2-user/.config/act/actrc:
                -P ubuntu-latest=catthehacker/ubuntu:act-latest
                -P ubuntu-22.04=catthehacker/ubuntu:act-22.04
                -P ubuntu-20.04=catthehacker/ubuntu:act-20.04
                -P ubuntu-18.04=catthehacker/ubuntu:act-18.04
Build info:
        Go version:            go1.24.1
        Module path:           github.com/nektos/act
        Main version:          v0.2.76+dirty
        Main path:             github.com/nektos/act
        Main checksum:         
        Build settings:
                -buildmode:           exe
                -compiler:            gc
                -trimpath:            true
                CGO_ENABLED:          0
                GOARCH:               amd64
                GOOS:                 linux
                GOAMD64:              v1
                vcs:                  git
                vcs.revision:         5668308bac0d256c8a4c3aa1467d2ebcb55bc717
                vcs.time:             2025-02-01T14:37:09Z
                vcs.modified:         true
Docker Engine:
        Engine version:        25.0.8
        Engine runtime:        runc
        Cgroup version:        2
        Cgroup driver:         systemd
        Storage driver:        overlay2
        Registry URI:          https://index.docker.io/v1/
        OS:                    Amazon Linux 2023.7.20250512
        OS type:               linux
        OS version:            2023
        OS arch:               x86_64
        OS kernel:             6.1.134-152.225.amzn2023.x86_64
        OS CPU:                8
        OS memory:             31714 MB
        Security options:
                name=seccomp,profile=builtin
                name=cgroupns

Command used with act

gh act  -s GITHUB_TOKEN="$(gh auth token)"  -e ./local/pr-event-file.json   --github-instance myghinstance -W ./.github/workflows/myWF.yml \
-Pxy=catthehacker/ubuntu:act-latest

Describe issue

Workflow works well if it is run on Github runner for Github Actions. Based on documentation action/clone should persist credentials for subsequent git commands:
The auth token is persisted in the local git config. This enables your scripts to run authenticated git commands. The token is removed during post-job cleanup. Set persist-credentials: false to opt-out.
But as you can see from log git repo is successfully cloned a and git status success, but git fetch origin main fails :
fatal: could not read Username for 'https://redacted': terminal prompts disabled

No response

Workflow content

name: Validate and Push Single Docker Image

on:
  pull_request:
    paths:
      - 'docker-images/**'

jobs:
  validate-and-push-docker-image:
    runs-on:
      - xy
    steps:
    steps:
      - name: Checkout code
        uses: actions/checkout@v4
        with:
          persist-credentials: true
      - name: Get changed files
        id: get-changed-files
        run: |
          git status
          git fetch origin main

Relevant log output

[DEBUG] Exec command '[bash -e /var/run/act/workflow/get-changed-files]'
[Validate and Push Single Docker Image/validate-and-push-docker-image] [DEBUG] Working directory '//redacted/repo'
| On branch feature/test-pr
| Changes to be committed:
|   (use "git restore --staged <file>..." to unstage)
|       new file:   local/runValidateImage-self-hosted.sh
| 
| Changes not staged for commit:
|   (use "git add <file>..." to update what will be committed)
|   (use "git restore <file>..." to discard changes in working directory)
|       modified:   .github/workflows/validate_push_image.yml
|       modified:   local/runValidateImage-self-hosted.sh
|       modified:   local/runValidateImage.sh
| 
| fatal: could not read Username for 'https://redacted': terminal prompts disabled
[Validate and Push Single Docker Image/validate-and-push-docker-image]   ❌  Failure - Main Get changed files [222.135229ms]
[Validate and Push Single Docker Image/validate-and-push-docker-image] exitcode '128': failure

Additional information

Originally created by @PavelKa on GitHub (Jun 9, 2025). Original GitHub issue: https://github.com/nektos/act/issues/5244 ### Bug report info ```plain text act version: 0.2.76 GOOS: linux GOARCH: amd64 NumCPU: 8 Docker host: DOCKER_HOST environment variable is not set Sockets found: /var/run/docker.sock Config files: /home/ec2-user/.config/act/actrc: -P ubuntu-latest=catthehacker/ubuntu:act-latest -P ubuntu-22.04=catthehacker/ubuntu:act-22.04 -P ubuntu-20.04=catthehacker/ubuntu:act-20.04 -P ubuntu-18.04=catthehacker/ubuntu:act-18.04 Build info: Go version: go1.24.1 Module path: github.com/nektos/act Main version: v0.2.76+dirty Main path: github.com/nektos/act Main checksum: Build settings: -buildmode: exe -compiler: gc -trimpath: true CGO_ENABLED: 0 GOARCH: amd64 GOOS: linux GOAMD64: v1 vcs: git vcs.revision: 5668308bac0d256c8a4c3aa1467d2ebcb55bc717 vcs.time: 2025-02-01T14:37:09Z vcs.modified: true Docker Engine: Engine version: 25.0.8 Engine runtime: runc Cgroup version: 2 Cgroup driver: systemd Storage driver: overlay2 Registry URI: https://index.docker.io/v1/ OS: Amazon Linux 2023.7.20250512 OS type: linux OS version: 2023 OS arch: x86_64 OS kernel: 6.1.134-152.225.amzn2023.x86_64 OS CPU: 8 OS memory: 31714 MB Security options: name=seccomp,profile=builtin name=cgroupns ``` ### Command used with act ```sh gh act -s GITHUB_TOKEN="$(gh auth token)" -e ./local/pr-event-file.json --github-instance myghinstance -W ./.github/workflows/myWF.yml \ -Pxy=catthehacker/ubuntu:act-latest ``` ### Describe issue Workflow works well if it is run on Github runner for Github Actions. Based on documentation action/clone should persist credentials for subsequent git commands: The auth token is persisted in the local git config. This enables your scripts to run authenticated git commands. The token is removed during post-job cleanup. Set persist-credentials: false to opt-out. But as you can see from log git repo is successfully cloned a and git status success, but git fetch origin main fails : fatal: could not read Username for 'https://redacted': terminal prompts disabled ### Link to GitHub repository _No response_ ### Workflow content ```yml name: Validate and Push Single Docker Image on: pull_request: paths: - 'docker-images/**' jobs: validate-and-push-docker-image: runs-on: - xy steps: steps: - name: Checkout code uses: actions/checkout@v4 with: persist-credentials: true - name: Get changed files id: get-changed-files run: | git status git fetch origin main ``` ### Relevant log output ```sh [DEBUG] Exec command '[bash -e /var/run/act/workflow/get-changed-files]' [Validate and Push Single Docker Image/validate-and-push-docker-image] [DEBUG] Working directory '//redacted/repo' | On branch feature/test-pr | Changes to be committed: | (use "git restore --staged <file>..." to unstage) | new file: local/runValidateImage-self-hosted.sh | | Changes not staged for commit: | (use "git add <file>..." to update what will be committed) | (use "git restore <file>..." to discard changes in working directory) | modified: .github/workflows/validate_push_image.yml | modified: local/runValidateImage-self-hosted.sh | modified: local/runValidateImage.sh | | fatal: could not read Username for 'https://redacted': terminal prompts disabled [Validate and Push Single Docker Image/validate-and-push-docker-image] ❌ Failure - Main Get changed files [222.135229ms] [Validate and Push Single Docker Image/validate-and-push-docker-image] exitcode '128': failure ``` ### Additional information
kerem 2026-03-01 21:50:02 +03:00
  • closed this issue
  • added the
    kind/bug
    label
Author
Owner

@PavelKa commented on GitHub (Jun 10, 2025):

By default, actions/checkout is skipped, so it is not called in the workflow and authentication is not applied. When the --no-skip-checkout flag is used, the checkout step is performed and subsequent commands do not fail.

<!-- gh-comment-id:2957866198 --> @PavelKa commented on GitHub (Jun 10, 2025): By default, actions/checkout is skipped, so it is not called in the workflow and authentication is not applied. When the --no-skip-checkout flag is used, the checkout step is performed and subsequent commands do not fail.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/act#1266
No description provided.