0

How can I set git config --global init.defaultBranch main during the FETCHSOURCE step in google cloud build?

The mission is silencing this redundant message:

hint: Using 'master' as the name for the initial branch. This
default branch name hint: is subject to change. To configure the
initial branch name to use in all hint: of your new repositories,
which will suppress this warning, call: hint: hint:     git config
--global init.defaultBranch <name>

I've tried this in step 0 of cloudbuild.yaml but it runs after FETCHSOURCE

steps:
- name: 'gcr.io/cloud-builders/git'   args: [ 'config',  '--global', 'init.defaultBranch', 'master']
2
  • Are you trying to disable the hint message about the initial branch name? If that’s the case, the message is basically suggesting that you set your default branch name to something other than master like main for example. You can refer to this similar question about disabling the git message. Commented Jun 24 at 22:03
  • yes but the names must remain. it's more about how to configure the FETCHSOURCE step in gloud-build, since cloudbuild.yaml starts after that step Commented Jul 22 at 23:40

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.