When trying to 'commit' files the process just loads and loads but never completes.

These are the steps I followed:
I installed "Git"
Created a repository for my files and then put some random files in there
Opened VS Code and opened my repository folder
Navigated to "Source Control"
Staged my documents (I didn't actually make any changes to the files but I just wanted to test it out since it's my first time using the tool).
Clicked "Commit"
When I clicked "Commit" I got an error which read:
"Make sure you configure your 'user.name' and 'user.email' in git."
I found this link on Stack Overflow: "Make sure you configure your 'user.email' and 'user.name' in git" when trying to push to git lab, and using that link, I opened the terminal and typed:
git config --global user.name "My name"
git config --global user.email "myemail"
Please see the image below:

I then clicked 'Commit', it began running but it just loaded indefinitely and never completed.
Does anyone know how I can fix this problem?.
I really tried to find a solution online. People suggested updating Visual Studio Code, fortunately mine is already up to date.
I have no idea why Git does this. It happens to me occasionally, but there are some solutions.
First, restart Visual Studio Code. Then try to commit & push again. If it still doesn't work, restart it again and this time, don't forget to write a message while committing.
You can also do
git commit -m 'message'
as it sometimes works. You can try that too.
I mostly experience this issue when I forget to write a message while committing or when there is an update to Git.
This happened to me when I forgot to write a commit message.
When git is run without a commit message it will open an editor to allow for longer messages, thus leading to it hanging forever.
If on Linux you can open htop, search for git and kill the process, not sure how that would be done on Windows.
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