Disable git advice on detached checkout
We're seeing this git advice in our build logs about detached HEAD state due to how BuildKite agent checks out build commits. It isn't really helpful for automated flows, it's aimed at new git users I guess.
PR should save 16 lines of output for Buildkite users, we're trying to reduce noise in our build logs so they're more actionable when a developer opens the log 😬
$ git clone XXXX
Cloning into '.'...
Warning: Permanently added the ECDSA host key for IP address '' to the list of known hosts.
remote: Enumerating objects: 87, done.
remote: Counting objects: 100% (61/61), done.
remote: Compressing objects: 100% (14/14), done.
remote: Total 45 (delta 13), reused 38 (delta 7), pack-reused 0
Receiving objects: 100% (45/45), done.
Resolving deltas: 100% (13/13), completed with 7 local objects.
Updating files: 100% (xx/xx), done.
$ git clean -ffxdq
# Fetch and checkout pull request head from GitHub
$ git fetch -- origin refs/pull/xxxxxx/head
Warning: Permanently added the ECDSA host key for IP address 'xxxx' to the list of known hosts.
From github.com:lyft/instant-android
* branch refs/pull/xxx/head -> FETCH_HEAD
# FETCH_HEAD is now `yyy`
$ git checkout -f yyy
Note: switching to 'yyy'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:
git switch -c <new-branch-name>
Or undo this operation with:
git switch -
Turn off this advice by setting config variable advice.detachedHead to false
Sorry, didn't find how to run tests in your setup in the docs, so it might fail on CI 😰 and I don't seem to have permissions to open CI checks in this repo nor don't they run on my PR w/o your approval it seems, filed an issue for that https://github.com/buildkite/agent/issues/1879
hi there! thanks for your contribution, i see this all the time and it annoys me too.
For the moment at least, we're keeping the agent CI private. This branch is currently failing go fmt, and some of the tests are failing. If you could fix these up we'd be happy to merge :)
I've updated the test and formatting, but again want to note that there are no instructions on this in the repo (I don't write Go usually) and I can't view what's wrong on CI, please fix this on your end :)
want to note that there are no instructions on this in the repo
this is a really good callout - i have a PR up to polish the contribution guide a little bit here: #1885
I've fixed the errors you mentioned and locally everything passes for me, I can't view the CI error (filed #1879 for that), can you please copy-paste the error from CI log so I could fix it? Thanks