Skip to content

Error pushing files to initial PR #39

Open
@oscard0m

Description

@oscard0m

When executing npm init octoherd-script I get the following issue:

$ git add .github/workflows/release.yml
$ git commit -m 'ci(release): initial version'
$ git add .github/workflows/test.yml
$ git commit -m 'ci(test): initial version'
$ git push
Error: Command failed with exit code 1: git push
To github.com:oscard0m/octoherd-script-sync-repo-settings.git
 ! [rejected]        initial-version -> initial-version (fetch first)
error: failed to push some refs to 'github.com:oscard0m/octoherd-script-sync-repo-settings.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
    at makeError (/Users/XXXXX/.npm/_npx/7261/lib/node_modules/create-octoherd-script/node_modules/execa/lib/error.js:59:11)
    at handlePromise (/Users/XXXX/.npm/_npx/7261/lib/node_modules/create-octoherd-script/node_modules/execa/index.js:116:26)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async command (file:///Users/XXXX/.npm/_npx/7261/lib/node_modules/create-octoherd-script/lib/command.js:5:30)
    at async main (file:///Users/XXXX/.npm/_npx/7261/lib/node_modules/create-octoherd-script/cli.js:248:5) {
  shortMessage: 'Command failed with exit code 1: git push',
  command: 'git push',
  exitCode: 1,
  signal: undefined,
  signalDescription: undefined,
  stdout: '',
  stderr: 'To github.com:oscard0m/octoherd-script-sync-repo-settings.git\n' +
    ' ! [rejected]        initial-version -> initial-version (fetch first)\n' +
    "error: failed to push some refs to 'github.com:oscard0m/octoherd-script-sync-repo-settings.git'\n" +
    'hint: Updates were rejected because the remote contains work that you do\n' +
    'hint: not have locally. This is usually caused by another repository pushing\n' +
    'hint: to the same ref. You may want to first integrate the remote changes\n' +
    "hint: (e.g., 'git pull ...') before pushing again.\n" +
    "hint: See the 'Note about fast-forwards' in 'git push --help' for details.",
  failed: true,
  timedOut: false,
  isCanceled: false,
  killed: false
}

PR where this happened: https://github.com/oscard0m/octoherd-script-sync-repo-settings/pull/1/commits

This is because of squash-commit-app[bot] is doing an empty commit in the middle. I think this script should recover from this error in some way:

  • Option 1: Wait with a prompt until the user resolves the conflict manually
  • Option 2: Notify somehow what steps where remaining so the user can manually fix them
  • Option 3: Not a fan at all of this one: Retry with push force? Pull before each push?
  • Other ideas?

On the other hand, squash-commit-app issue has been created: squash-commit-app/squash-commit-app#13

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions