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

[Bug]: fatal: No configured push destination #451

Closed
qazi0 opened this issue Feb 28, 2025 · 1 comment
Closed

[Bug]: fatal: No configured push destination #451

qazi0 opened this issue Feb 28, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@qazi0
Copy link

qazi0 commented Feb 28, 2025

Opencommit Version

3.2.5

Node Version

23.4.0

NPM Version

10.9.2

What OS are you seeing the problem on?

Mac

What happened?

If you run oco without having set a remote destination, it crashes with

siraj at blakberrisigma in …/testing at  master () 󰁽 87% on 21:11
> oco
┌  open-commit
│
◇  No files are staged
│
◇  Do you want to stage all files and generate commit message?
│  No
│
◇  Select the files you want to add to the commit:
│  somefile.txt
│
◇  Done
┌  open-commit
│
◇  1 staged files:
  somefile.txt
│
◇  📝 Commit message generated
│
└  Generated commit message:
——————————————————
feat(somefile.txt): add somefile.txt with universe-breaking changes and heavy commit
——————————————————

│
◇  Confirm the commit message?
│  Yes
│
◇  ✔ Successfully committed
│
└  [master (root-commit) 14700fa] feat(somefile.txt): add somefile.txt with universe-breaking changes and heavy commit
 1 file changed, 4 insertions(+)
│
◇  ✖ Failed to generate the commit message
Error: Command failed with exit code 128: git push
fatal: No configured push destination.
Either specify the URL from the command-line or configure a remote repository using

    git remote add <name> <url>

and then push using the remote name

    git push <name>

    at makeError (/opt/homebrew/lib/node_modules/opencommit/out/cli.cjs:48250:13)
    at handlePromise (/opt/homebrew/lib/node_modules/opencommit/out/cli.cjs:48706:29)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async generateCommitMessageFromGitDiff (/opt/homebrew/lib/node_modules/opencommit/out/cli.cjs:64660:37)
    at async trytm (/opt/homebrew/lib/node_modules/opencommit/out/cli.cjs:64584:18)
    at async commit (/opt/homebrew/lib/node_modules/opencommit/out/cli.cjs:64786:35)
    at async commit (/opt/homebrew/lib/node_modules/opencommit/out/cli.cjs:64779:5) {
  shortMessage: 'Command failed with exit code 128: git push',
  command: 'git push',
  escapedCommand: 'git push',
  exitCode: 128,
  signal: undefined,
  signalDescription: undefined,
  stdout: '',
  stderr: 'fatal: No configured push destination.\n' +
    'Either specify the URL from the command-line or configure a remote repository using\n' +
    '\n' +
    '    git remote add <name> <url>\n' +
    '\n' +
    'and then push using the remote name\n' +
    '\n' +
    '    git push <name>\n',
  cwd: '/Users/siraj/testing',
  failed: true,
  timedOut: false,
  isCanceled: false,
  killed: false
}
│
└  ✖ Command failed with exit code 128: git push
fatal: No configured push destination.
Either specify the URL from the command-line or configure a remote repository using

    git remote add <name> <url>

and then push using the remote name

    git push <name>

I'm aware that a remote should be set first, but the tool should still gracefully exit with an error message, instead of crashing, just logging it here if you think this should be fixed.

Expected Behavior

opencommit should gracefully exit with an error message if no remote url is specified, instead of crashing.

Current Behavior

Errors out with a crash (See above log)

Possible Solution

Handling the condition of no remote url specified with an error message

Steps to Reproduce

mkdir testing && cd testing
echo "some legendary change" >> somefile.txt
git init
oco
.. 
// choose to generate commit message and then commit the file

Relevant log output

@qazi0 qazi0 added the bug Something isn't working label Feb 28, 2025
@qazi0
Copy link
Author

qazi0 commented Mar 1, 2025

Edit: I'm guessing this crash is an expected behaviour looking at the test case push and cause error when there is no remote, so its designed to crash-error instead of gracefully handling it

@qazi0 qazi0 closed this as completed Mar 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant