While I am trying to make a commit to my local git branch I got this error
fatal: could not read '/Users/<username>/.stCommitMsg': No such file or directory
I am able to commit using
git commit -m "commit message"
but I am unable to commit using
git commit
I am using macOS Sierra, and git version 2.10.1 (Apple Git-78)
To fix the “pulling is not possible” error, you can use git reset –hard. Always write a commit message after adding a file to Git's history. Ensure your files are updated to avoid conflict when pulling changes. You need to commit your changes or stash them before you can merge.
On the command line, navigate to the repository that contains the commit you want to amend. Type git commit --amend and press Enter. In your text editor, edit the commit message, and save the commit. You can add a co-author by adding a trailer to the commit.
Committing in Git without a message So if you don't have anything to commit, you will be told that there is nothing to commit without the text editor being opened. So if your text editor opens up after the command, there is definitely something to commit.
The “changes not staged for commit” message shows when you run the “git status” command and have a file that has been changed but has not yet been added to the staging area. This is not an error message, rather a notification that you have changed files that are not in the staging area or a commit.
When run git commit
, git will read from configure variable commit.template to find commit message template and load it to editor for you to write commit message.
For your error, it seems that it try to find a template file of '/Users/<username>/.stCommitMsg
. please create it for you or edit ~/.gitconfig to delete commit.template item.
By the way, you can check your configuration by git config --get commit.template
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