Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error in commiting to git saying stCommitMsg file not found

Tags:

git

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)

like image 651
Dhairya Seth Avatar asked Jan 12 '17 06:01

Dhairya Seth


People also ask

How do you resolve committing is not possible because you have unmerged files?

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.

How do I add a new commit message?

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.

What happens if commit without message?

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.

Why are some files not staged for 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.


1 Answers

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

like image 114
gzh Avatar answered Sep 20 '22 07:09

gzh