Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error pushing files to initial PR #39

Open
oscard0m opened this issue Jun 1, 2021 · 1 comment
Open

Error pushing files to initial PR #39

oscard0m opened this issue Jun 1, 2021 · 1 comment

Comments

@oscard0m
Copy link
Member

oscard0m commented Jun 1, 2021

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

@gr2m
Copy link
Member

gr2m commented Jun 1, 2021

Option 3: Not a fan at all of this one: Retry with push force? Pull before each push?

honestly probably that's what I'd do right now. These commits are meant to be atomic, everything else should take a back seat and wait until its done. I'd just always use --force 🤷🏼

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants