Quinn.hen
Quinn.hen

Reputation: 202

git commit error : name consists only of disallowed characters:

create a new git project and only add README.txt when I commit, an error occurred.

enter image description here

Upvotes: 15

Views: 17412

Answers (2)

Daniiar Abdraiymov
Daniiar Abdraiymov

Reputation: 11

To be more specific,
1) git config --local --list
Check your local config for this local repo, with the command above
Look for the user.name and user.email,
user.name =
user.email =
If you see the following, meaning they're empty

Type:
2) git config --local user.name ['user name']
3) git config --local user.email ['[email protected]']

Explanation:
By typing following 2nd and 3rd command you're setting your local config, which means the commits from your local repo will be made from this user name and email on Github

By doing that you're able to contribute to remote Repo as a different user from different user.name and user.email

If you don't specify --global or --local config , you'll end up having this issue,
However having one of them works fine, as long as you identified yourself as someone

It shouldn't be empty, bc it's not allowed to commit as an UNKOWN USER on github, so make sure you specify, by which name you're contributing

Upvotes: 1

Complex
Complex

Reputation: 361

The Problem here seems to be your username. Check it with git config --list. You can change it with

$ git config --global user.name "validName"

Upvotes: 31

Related Questions