Hub: `hub pull request` opens text editor then aborts and closes text editor before message can be entered.

Created on 7 Aug 2020  路  7Comments  路  Source: github/hub

Command attempted:

hub pull-request

What happened:

PyCharm editor opens up a text file to add the pull request message, but the command line aborts the attempted pull-request within a few seconds, with aborting due to empty pull request title, leaving no time to write the message in my text editor. PyCharm subsequently closes the text file automatically.

*Steps to reproduce: *
I was simply attempting to replicate the steps for creating a pull request found here: https://hub.github.com/:

  1. The repo I am working on already exists locally and on GitHub.
  2. I have two branches 'master' and 'develop'
  3. Made change on 'develop' branch, commit and push
  4. use hub pull-request
  5. Start typing pull-request message in text editor opened by PyCharm
  6. Mid-way, command line notifies me that the pull request is being aborted.
  7. PyCharm closes text editor.

More info:

git version 2.23.0.windows.1
hub version 2.14.2
Windows 10, using Git Bash

bug more-info-needed

All 7 comments

Thank you for reporting! This sounds like an issue with the editor process that hub shells out to.

Can you check your git var GIT_EDITOR? That's the value that hub will invoke as an editor. If it's a graphical application, like PyCharm sounds like it is, it's important to pass in flags that ensure that the process blocks until the file under editing is saved. It sounds like your editor process does not block and exit prematurely before you've even saved the file.

This might be solvable by changing your editor command: `git config --global core.editor "my command --here"

Hi Mislav, yes PyCharm is an IDE, and GIT_EDITOR does point to it. Let me know if there is any more information you need.

As to your possible work-around, what are you suggesting goes in the "my command --here" spot?

Ah, I see. I can change git's default text editor. I just added sublime text. We'll see if that does any better next time I have to do a PR.

yes PyCharm is an IDE, and GIT_EDITOR does point to it.

Would you share with us this value? Or, would you check that the --wait flag is present?

Example: pycharm64.exe --wait

The Sublime Text workaround is also valid 馃憤 Basically, any editor will do, as long as the process waits until the file has been saved and closed

Okay, forgive my ignorance here. If you couldn't tell, I'm somewhat amateurish. To answer your questions:

  1. GIT_EDITOR just contained the path to PyCharm: "C:\Program Files\JetBrains\PyCharm Community Edition 2019.1.2\bin\pycharm64.exe"

  2. There was no --wait flag inside of GIT_EDITOR. I read how to use the flag here: https://swcarpentry.github.io/git-novice/02-setup/.

I changed GIT_EDITOR to point at subl --wait, and will see if it works now :)

  1. GIT_EDITOR just contained the path to PyCharm: "C:\Program Files\JetBrains\PyCharm Community Edition 2019.1.2\bin\pycharm64.exe"

Thanks for sharing! As I pointed out, if you're going to use PyCharm as your git editor (used by both git commit and hub pull-request), you will have to add --wait at the end of the core.editor configuration value, the same as you're already adding for Sublime Text. Whatever works for you!

Closing since this turned out to be a configuration issue. 馃檱

@mislav I just want to say thanks. I know this isn't a help forum (and I didn't think I was asking for help), but that's what it turned in to. You kindly obliged to help me and my "bug" which was really just user error, and for that I am thankful. Kudos for being so helpful and non-condescending to a beginner.

You're welcome, @wcneill. Your kind words mean much to me

Was this page helpful?
0 / 5 - 0 ratings

Related issues

wwwdata picture wwwdata  路  3Comments

cbeams picture cbeams  路  4Comments

kentcdodds picture kentcdodds  路  4Comments

stsewd picture stsewd  路  4Comments

dsifford picture dsifford  路  4Comments