Open
Description
Getting the following error:
Error: fatal: Cannot fetch both <sha> and refs/tags/<tag> to refs/tags/<tag>
Example workflow:
name: Release
on:
workflow_dispatch:
# Triggers the workflow on tag events
push:
tags: '*'
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 250
fetch-tags: true
Raw log
2023-09-06T20:54:11.5281780Z Requested labels: ubuntu-latest
2023-09-06T20:54:11.5282085Z Job defined at: Molkree/github_actions/.github/workflows/workflow.yml@refs/tags/V1
2023-09-06T20:54:11.5282200Z Waiting for a runner to pick up this job...
2023-09-06T20:54:12.2788574Z Job is waiting for a hosted runner to come online.
2023-09-06T20:54:15.6896729Z Job is about to start running on the hosted runner: GitHub Actions 2 (hosted)
2023-09-06T20:54:17.8444082Z Current runner version: '2.308.0'
2023-09-06T20:54:17.8473502Z ##[group]Operating System
2023-09-06T20:54:17.8474111Z Ubuntu
2023-09-06T20:54:17.8474513Z 22.04.3
2023-09-06T20:54:17.8474765Z LTS
2023-09-06T20:54:17.8475076Z ##[endgroup]
2023-09-06T20:54:17.8475431Z ##[group]Runner Image
2023-09-06T20:54:17.8475752Z Image: ubuntu-22.04
2023-09-06T20:54:17.8476128Z Version: 20230821.1.0
2023-09-06T20:54:17.8476673Z Included Software: https://github.com/actions/runner-images/blob/ubuntu22/20230821.1/images/linux/Ubuntu2204-Readme.md
2023-09-06T20:54:17.8477311Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu22%2F20230821.1
2023-09-06T20:54:17.8477802Z ##[endgroup]
2023-09-06T20:54:17.8478168Z ##[group]Runner Image Provisioner
2023-09-06T20:54:17.8478513Z 2.0.266.1
2023-09-06T20:54:17.8478820Z ##[endgroup]
2023-09-06T20:54:17.8480162Z ##[group]GITHUB_TOKEN Permissions
2023-09-06T20:54:17.8480834Z Actions: write
2023-09-06T20:54:17.8481218Z Checks: write
2023-09-06T20:54:17.8481797Z Contents: write
2023-09-06T20:54:17.8482190Z Deployments: write
2023-09-06T20:54:17.8482577Z Discussions: write
2023-09-06T20:54:17.8482935Z Issues: write
2023-09-06T20:54:17.8483217Z Metadata: read
2023-09-06T20:54:17.8483553Z Packages: write
2023-09-06T20:54:17.8483914Z Pages: write
2023-09-06T20:54:17.8484212Z PullRequests: write
2023-09-06T20:54:17.8484605Z RepositoryProjects: write
2023-09-06T20:54:17.8484990Z SecurityEvents: write
2023-09-06T20:54:17.8485340Z Statuses: write
2023-09-06T20:54:17.8485656Z ##[endgroup]
2023-09-06T20:54:17.8489434Z Secret source: Actions
2023-09-06T20:54:17.8489965Z Prepare workflow directory
2023-09-06T20:54:17.9244286Z Prepare all required actions
2023-09-06T20:54:17.9441016Z Getting action download info
2023-09-06T20:54:18.1502062Z Download action repository 'actions/checkout@v4' (SHA:3df4ab11eba7bda6032a0b82a6bb43b11571feac)
2023-09-06T20:54:18.6047878Z Complete job name: release
2023-09-06T20:54:18.7039155Z ##[group]Run actions/checkout@v4
2023-09-06T20:54:18.7039717Z with:
2023-09-06T20:54:18.7040031Z fetch-depth: 250
2023-09-06T20:54:18.7040298Z fetch-tags: true
2023-09-06T20:54:18.7040608Z repository: Molkree/github_actions
2023-09-06T20:54:18.7041197Z token: ***
2023-09-06T20:54:18.7041482Z ssh-strict: true
2023-09-06T20:54:18.7041770Z persist-credentials: true
2023-09-06T20:54:18.7042069Z clean: true
2023-09-06T20:54:18.7042378Z sparse-checkout-cone-mode: true
2023-09-06T20:54:18.7042696Z show-progress: true
2023-09-06T20:54:18.7042970Z lfs: false
2023-09-06T20:54:18.7043230Z submodules: false
2023-09-06T20:54:18.7043513Z set-safe-directory: true
2023-09-06T20:54:18.7043798Z ##[endgroup]
2023-09-06T20:54:19.0017138Z Syncing repository: Molkree/github_actions
2023-09-06T20:54:19.0076797Z ##[group]Getting Git version info
2023-09-06T20:54:19.0077771Z Working directory is '/home/runner/work/github_actions/github_actions'
2023-09-06T20:54:19.0079224Z [command]/usr/bin/git version
2023-09-06T20:54:19.0091807Z git version 2.41.0
2023-09-06T20:54:19.0121375Z ##[endgroup]
2023-09-06T20:54:19.0207526Z Temporarily overriding HOME='/home/runner/work/_temp/2678c0f7-1146-4df1-ba64-9dafbaaf9b22' before making global git config changes
2023-09-06T20:54:19.0208204Z Adding repository directory to the temporary git global config as a safe directory
2023-09-06T20:54:19.0208921Z [command]/usr/bin/git config --global --add safe.directory /home/runner/work/github_actions/github_actions
2023-09-06T20:54:19.0265359Z Deleting the contents of '/home/runner/work/github_actions/github_actions'
2023-09-06T20:54:19.0266187Z ##[group]Initializing the repository
2023-09-06T20:54:19.0266618Z [command]/usr/bin/git init /home/runner/work/github_actions/github_actions
2023-09-06T20:54:19.0330716Z hint: Using 'master' as the name for the initial branch. This default branch name
2023-09-06T20:54:19.0334071Z hint: is subject to change. To configure the initial branch name to use in all
2023-09-06T20:54:19.0337832Z hint: of your new repositories, which will suppress this warning, call:
2023-09-06T20:54:19.0341189Z hint:
2023-09-06T20:54:19.0344118Z hint: git config --global init.defaultBranch <name>
2023-09-06T20:54:19.0346914Z hint:
2023-09-06T20:54:19.0349701Z hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
2023-09-06T20:54:19.0352666Z hint: 'development'. The just-created branch can be renamed via this command:
2023-09-06T20:54:19.0355422Z hint:
2023-09-06T20:54:19.0358966Z hint: git branch -m <name>
2023-09-06T20:54:19.0434933Z Initialized empty Git repository in /home/runner/work/github_actions/github_actions/.git/
2023-09-06T20:54:19.0436097Z [command]/usr/bin/git remote add origin https://github.com/Molkree/github_actions
2023-09-06T20:54:19.0448271Z ##[endgroup]
2023-09-06T20:54:19.0449725Z ##[group]Disabling automatic garbage collection
2023-09-06T20:54:19.0474091Z [command]/usr/bin/git config --local gc.auto 0
2023-09-06T20:54:19.0529491Z ##[endgroup]
2023-09-06T20:54:19.0530029Z ##[group]Setting up auth
2023-09-06T20:54:19.0530602Z [command]/usr/bin/git config --local --name-only --get-regexp core\.sshCommand
2023-09-06T20:54:19.0557039Z [command]/usr/bin/git submodule foreach --recursive sh -c "git config --local --name-only --get-regexp 'core\.sshCommand' && git config --local --unset-all 'core.sshCommand' || :"
2023-09-06T20:54:19.0924414Z [command]/usr/bin/git config --local --name-only --get-regexp http\.https\:\/\/github\.com\/\.extraheader
2023-09-06T20:54:19.0956478Z [command]/usr/bin/git submodule foreach --recursive sh -c "git config --local --name-only --get-regexp 'http\.https\:\/\/github\.com\/\.extraheader' && git config --local --unset-all 'http.https://github.com/.extraheader' || :"
2023-09-06T20:54:19.1182729Z [command]/usr/bin/git config --local http.https://github.com/.extraheader AUTHORIZATION: basic ***
2023-09-06T20:54:19.1245799Z ##[endgroup]
2023-09-06T20:54:19.1246486Z ##[group]Fetching the repository
2023-09-06T20:54:19.1256140Z [command]/usr/bin/git -c protocol.version=2 fetch --prune --no-recurse-submodules --depth=250 origin +ec23d78ecbc48f9a867575b74a5416b78213d380:refs/tags/V1
2023-09-06T20:54:19.3386207Z ##[error]fatal: Cannot fetch both ec23d78ecbc48f9a867575b74a5416b78213d380 and refs/tags/V1 to refs/tags/V1
2023-09-06T20:54:19.3401260Z The process '/usr/bin/git' failed with exit code 128
2023-09-06T20:54:19.3401907Z Waiting 19 seconds before trying again
2023-09-06T20:54:38.3455042Z [command]/usr/bin/git -c protocol.version=2 fetch --prune --no-recurse-submodules --depth=250 origin +ec23d78ecbc48f9a867575b74a5416b78213d380:refs/tags/V1
2023-09-06T20:54:38.4980618Z ##[error]fatal: Cannot fetch both ec23d78ecbc48f9a867575b74a5416b78213d380 and refs/tags/V1 to refs/tags/V1
2023-09-06T20:54:38.5018376Z The process '/usr/bin/git' failed with exit code 128
2023-09-06T20:54:38.5019247Z Waiting 16 seconds before trying again
2023-09-06T20:54:54.5093632Z [command]/usr/bin/git -c protocol.version=2 fetch --prune --no-recurse-submodules --depth=250 origin +ec23d78ecbc48f9a867575b74a5416b78213d380:refs/tags/V1
2023-09-06T20:54:54.6735953Z ##[error]fatal: Cannot fetch both ec23d78ecbc48f9a867575b74a5416b78213d380 and refs/tags/V1 to refs/tags/V1
2023-09-06T20:54:54.6833580Z ##[error]The process '/usr/bin/git' failed with exit code 128
2023-09-06T20:54:54.7213201Z Post job cleanup.
2023-09-06T20:54:54.8171576Z [command]/usr/bin/git version
2023-09-06T20:54:54.8204035Z git version 2.41.0
2023-09-06T20:54:54.8270408Z Temporarily overriding HOME='/home/runner/work/_temp/355ee677-37c5-4dd2-a63a-280e77b4a35e' before making global git config changes
2023-09-06T20:54:54.8271182Z Adding repository directory to the temporary git global config as a safe directory
2023-09-06T20:54:54.8271822Z [command]/usr/bin/git config --global --add safe.directory /home/runner/work/github_actions/github_actions
2023-09-06T20:54:54.8311274Z [command]/usr/bin/git config --local --name-only --get-regexp core\.sshCommand
2023-09-06T20:54:54.8359349Z [command]/usr/bin/git submodule foreach --recursive sh -c "git config --local --name-only --get-regexp 'core\.sshCommand' && git config --local --unset-all 'core.sshCommand' || :"
2023-09-06T20:54:54.8627983Z [command]/usr/bin/git config --local --name-only --get-regexp http\.https\:\/\/github\.com\/\.extraheader
2023-09-06T20:54:54.8648042Z http.https://github.com/.extraheader
2023-09-06T20:54:54.8659258Z [command]/usr/bin/git config --local --unset-all http.https://github.com/.extraheader
2023-09-06T20:54:54.8697155Z [command]/usr/bin/git submodule foreach --recursive sh -c "git config --local --name-only --get-regexp 'http\.https\:\/\/github\.com\/\.extraheader' && git config --local --unset-all 'http.https://github.com/.extraheader' || :"
2023-09-06T20:54:54.9259704Z Cleaning up orphan processes
What am I doing wrong here?
UPDATE March 2025: adding ref: ${{ github.ref }}
to the step fixes this if you want just one branch.
with:
fetch-depth: 250
fetch-tags: true
ref: ${{ github.ref }}
Metadata
Metadata
Assignees
Labels
No labels