Commit without setting user.email and user.name

后端 未结 3 2039
心在旅途
心在旅途 2020-12-07 16:21

I try to commit like this

git commit --author=\'Paul Draper \' -m \'My commit message\'

but I get

***          


        
3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-07 16:44

    It is worth noting, that git on linux will default to the linux user name as given in the "gecos" field in /etc/passwd. You can output this name with grep $(whoami) /etc/passwd | cut -d ':' -f 5. If this field is empty you cannot commit without setting a user name but if it is not empty git will use it. So you'd have yourself as author and the system user as committer.

    See https://github.com/git/git/blob/master/ident.c

提交回复
热议问题