I have a shell script that is run as part of a GitHub Actions workflow that, on occasion, clones a repository, creates, commits to, and pushes a branch, and then creates (or at least tries to) a pull request for the branch using gh pr create. However, gh is failing with "aborted: you must first push the current branch to a remote, or use the --head flag" despite the fact that the command immediately before it is "git push -u origin "$branch_name" (tried with & without the -u option).
- The repository is public.
- The remote URL used to check out the repository is of the form
https://x-access-token:[email protected]/$OWNER/$REPO, where the same token is also set as the $GITHUB_TOKEN environment variable.
- The command succeeds if the
--head option is used.
I have a shell script that is run as part of a GitHub Actions workflow that, on occasion, clones a repository, creates, commits to, and pushes a branch, and then creates (or at least tries to) a pull request for the branch using
gh pr create. However,ghis failing with "aborted: you must first push the current branch to a remote, or use the --head flag" despite the fact that the command immediately before it is "git push -u origin "$branch_name" (tried with & without the-uoption).https://x-access-token:[email protected]/$OWNER/$REPO, where the same token is also set as the$GITHUB_TOKENenvironment variable.--headoption is used.