Setting user data just for one commit

I don’t have the git user data set:

$ git commit -m '...'

*** Please tell me who you are.

Run

  git config --global user.email "you@example.com"
  git config --global user.name "Your Name"

to set your account's default identity.
Omit --global to set the identity only in this repository.

fatal: empty ident name (for <...>) not allowed

If I run these commands my user data will be set globally. I only want to have the user data set for one commit.

  • Is it possible to configure git mergetool to avoid .orig for a given merge tool?
  • How to delete stashes as a batch?
  • bitbucket authentication failing
  • How can I put $HOME/opt/git/bin to my PATH?
  • How to do git sub modules and why to use git sub module
  • How to make eclipse neon show git branch in package view?
  • Is there any argument that I can pass to git commit to set the user data?

  • GIT bash on Windows: VIM doesn't find Python3
  • How do I use remote machine's SSH keys in ansible git module
  • gitlab-shell push fatal error
  • svn (with git frontend) branch merging with different directory structure
  • Cannot add “dist” folder to github repo
  • How do I ask git, which commits are not on a branch?
  • 3 Solutions collect form web for “Setting user data just for one commit”

    The --author flag will set the author, but you must also set the committer name and email.

    There is no command-line flag for this but git will use environment variables if they are set: GIT_COMMITTER_NAME and GIT_COMMITTER_EMAIL.

    Assuming an sh/bash-style shell:

    GIT_COMMITTER_NAME='A U Thor' \
    GIT_COMMITTER_EMAIL='author@example.example' \
    git commit --author 'A U Thor <author@example.example>' ...
    

    should do it.

    Or, you can just set these in your git global configuration, then remove them (use git config --global -e to run your favorite editor on the file, if you don’t want to fiddle with git config --unset).

    Edit: or, you can configure them temporarily with git -c name=value, e.g.:

    git -c user.name='A U Thor' -c user.email=author@example.example commit ...
    

    Note that (as with the environment variables) this will override any file-configuration values.

    You can specify the author using the --author option:

    git commit --author="Corey Ward <corey@notmyemail.com>" -m "..."
    

    Author can be overridden by using the –author option

    see https://www.kernel.org/pub/software/scm/git/docs/git-commit.html

    Git Baby is a git and github fan, let's start git clone.