When I tried to make a commit using git commit
, the sublime text editor did open, I wrote the commit message and saved and closed the editor but the changes were not being committed. The terminal hanged at the git commit
.
I searched the net and found someone with the same issue and applied the same fix without thinking anything. I ran the command:
git config --global core.editor "mate -w"
and now I have a new error when I run git commit
:
mate -w: 1: mate -w: mate: not found error: There was a problem with the editor 'mate -w'. Please supply the message using either -m or -F option.
Please help. I am very new with git and using Ubuntu 14.04.
Git runs a lot of external bits as part of a commit. While Git itself is unlikely to hang, any of the external parts it calls could, so in order of execution:
pre-commit
hook. This is a script at $REPO_ROOT/.git/hooks/pre-commit
(it is not the .sample
file! It has to be one named, exactly and only, pre-commit
.) Check the contents of the script to see if it might hang.prepare-commit-msg
hook. It's right next to the pre-commit
hook, named like you'd expect. Same thing.-m
, then your editor starts so you can input the message. Make sure that
commit-msg
hook. Same as the other hooks.-S
with git commit
, or if you have commit.gpgsign = true
. You can check the latter with git config commit.gpgsign
. This also depends on your GPG agent. Check:
git commit
again, it'll start fresh; this may or may not help with your hanging.post-commit
hook.Note that I've only addressed manually creating commits. merge
will also create commits, and it follows largely the same sequence, with some different hooks.
In addition, Git itself can take a while if your repo is particularly large -- each commit is essentially a snapshot of all the files in it at a given time. If you judiciously use .gitignore
s to ignore things like built executables and just track the source code in your Git repo, it can help a lot. Note that this will break some editors: Visual Studio, in particular, is poorly designed and incompatible with Git as a result.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With