-
Notifications
You must be signed in to change notification settings - Fork 902
Open
Labels
Description
What happened?
The following pipeline deletes the source folder during the checkout step if the repository contains a file named HEAD
that is checked out by the previous pipeline run. Instead, it should just clean the git repository.
jobs:
- job: Bug
workspace:
clean: all
steps:
- checkout: self
This happens because git reset --hard HEAD
doesn't know whether HEAD
refers to the current commit or the HEAD
file. This can be fixed by either using git reset --hard
(recommended) or git reset --hard HEAD --
instead.
Versions
Agent version 4.258.1 / Windows 10
Environment type (Please select at least one enviroment where you face this issue)
- Self-Hosted
- Microsoft Hosted
- VMSS Pool
- Container
Azure DevOps Server type
dev.azure.com (formerly visualstudio.com)
Azure DevOps Server Version (if applicable)
No response
Operation system
No response
Version controll system
No response
Relevant log output
git version
git version 2.50.1.windows.1
git clean -ffdx
git reset --hard HEAD
fatal: ambiguous argument 'HEAD': both revision and filename
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
##[warning]Unable to run "git clean -ffdx" and "git reset --hard HEAD" successfully, delete source folder instead.