Skip to content
Versora

Manual

Getting started

Identity: name and email

16 min read

On this page

git records a name and an email in every commit. They're how GitLab and GitHub link the commit to your account, how push rules check the author and how the team knows who did what. Without a name and email configured, git refuses to create commits.

Versora offers three levels of identity, from the most general to the most specific:

LevelWhere it livesApplies toWhere to set it
Global~/.gitconfigAll your repositories without their own identityPreferences › Profile
Per folder or per server (rules)~/.gitconfig-versora-<rule>, linked to ~/.gitconfig by [includeIf]The repositories inside a folder, or with a remote on a serverPreferences › Identities
Only this repositoryThe repository's .git/configOne repositoryPreferences › Profile (with the repository open)

git itself decides which identity applies. That's why everything you set here also applies in the terminal and in other tools.

See which identity applies

Before changing anything, check which name and email your commits are made with, and where each value comes from.

Where to find it

  • Commit box: the Commit as badge shows the email that goes into the commit. Hover over it to see "Commits here are made as Ana Souza <[email protected]>." and the source; click to open Preferences › Identities.
  • Palette (Ctrl+P): "Which identity applies in this repository?".
  • Preferences › Profile: the box at the top, "In effect in loja-online:" (or "In effect for your repositories:", with no repository open).
  • Preferences › Identities: the box at the top, with the rules that match the repository.

Step by step

  1. With the repository open, press Ctrl+P and choose "Which identity applies in this repository?".
  2. The Identity in loja-online window shows:
    • Commits are made as: the name and email that apply;
    • Email and Name: where each one comes from (see the table below);
    • Matching rules: the folder or server rules that apply here ("none", if there are none);
    • Remote server: the server of the repository's remote.
  3. Click Open Identities to change it.

The possible sources of each value:

TextMeaning
"From the rule "Empresa" (…)."From a Versora folder or server rule.
"From the global config (…)."From ~/.gitconfig.
"From …, included by the git config."From a file included by a hand-written include/includeIf.
"From this repository's local config (.git/config)."From the repository's own identity.
"From this worktree's config."From the worktree configuration.
"From the system config."From the git installation's configuration.
"From the command line (-c)."From a -c user.email=… passed to git.
"From an environment variable (GIT_AUTHOR_EMAIL, GIT_AUTHOR_NAME or EMAIL)."From a Windows environment variable.
"Not set."There's no value.

What Versora does in git

Only reads, with git config --show-origin to find out where each value comes from.

Caveats and messages

  • The Commit as badge shows "no identity" when there's no name and email: "No name and email are set: git will refuse to commit."
  • The badge is highlighted when there's a problem, for example "The rule "Empresa" ([email protected]) matches this repository, but another setting overrides it." or "This is a company repository (empresa.com.br), but the email [email protected] isn't from that domain."

See also

Global identity

The global identity is the one that applies in every repository that doesn't have its own identity. It's the starting point: set it once (the first-run wizard already asks for it) and only use the other levels when you need exceptions.

Where to find it

  • Preferences › Profile, Global identity group.
  • Palette (Ctrl+P): "Preferences: profile (Git identity)".
  • Open Preferences with Ctrl+,.

Step by step

  1. Open Preferences › Profile.
  2. In the Global identity group, fill in Name (for example, Ana Souza) and Email (for example, [email protected]).
  3. Click Save global identity. The message "Global identity saved." confirms it.
  4. To discard what you typed without saving, click Undo changes.

To remove the global identity, clear both fields and click Save global identity. Versora asks first: "Without a global identity, Git can't create commits in repositories that don't have their own identity. Remove it anyway?" Confirm with Remove global identity.

FieldWhat it doesDefault
NameGlobal user.name. It can't contain <, > or line breaks.Whatever is already in ~/.gitconfig
EmailGlobal user.email. It must have the form [email protected].Whatever is already in ~/.gitconfig

The global identity is either complete or gone entirely: you can't save only the name or only the email ("Fill in both the name and the email.").

What Versora does in git

bash
git config --global --replace-all user.name "Ana Souza"
git config --global --replace-all user.email "[email protected]"

To remove it:

bash
git config --global --unset-all user.name
git config --global --unset-all user.email

How to undo

The identity isn't part of undo (Ctrl+Z): to go back, type the old values and save again. The form's Undo changes button only discards what hasn't been saved yet.

Caveats and messages

  • "Invalid email: expected something like [email protected]."
  • "The name can't contain the characters < and >."
  • "Enter both the name and the email of the global identity (or leave both empty to remove it)."
  • "Couldn't write the Git configuration (file locked or no permission).": another program is writing ~/.gitconfig. Wait and try again.
  • "No valid identity." with "Git needs a name and an email to record authorship: without them, commit, merge, revert and annotated tags fail. Fill in the global identity below."
  • In a repository that matches a rule, the Profile box warns: "The rule "Empresa" applies in this repository (it shows as global here because it comes in through the global config)." Changing the global form doesn't change the rule.

See also

Identity for this repository only

Use it when a repository needs another name or email and it isn't worth creating a rule (for example, a single personal project in a work folder). The repository identity overrides the global identity and the rules.

Where to find it

Preferences › Profile, In this repository loja-online group, with the repository open in the active tab. With no repository open, the group is called Per-repository identity and says "Open a repository in a tab to set an identity that applies only to it."

Step by step

  1. Open the repository and go to Preferences › Profile.
  2. Turn on Use a different identity in this repository.
  3. Fill in Name and/or Email. The fields show the global value in gray ("Ana Souza (global)"): "An empty field keeps using the global value."
  4. Click Save repository identity. The message "Identity for "loja-online" saved." confirms it.

To go back to the global identity, turn the switch off. Versora asks: "Remove the identity of "loja-online"? The next commits in this repository will use the global identity (Ana Souza <[email protected]>)." Confirm with Remove repository identity.

FieldWhat it doesDefault
Use a different identity in this repositoryShows the local identity fields.Off (on if the repository already has its own identity)
NameLocal user.name. Empty = uses the global one.Empty
EmailLocal user.email. Empty = uses the global one.Empty

What Versora does in git

bash
git config --local --replace-all user.email "[email protected]"

When you turn it off, the local values are removed with git config --local --unset-all.

How to undo

Turn the switch off (the identity goes back to the global one or the rule's). There's no Ctrl+Z.

Caveats and messages

  • "Fill in the name, the email or both."
  • "Open a repository to change its configuration."
  • An old local identity overrides a new rule. Versora warns you in the Commit as badge and before the commit (see "Identity warning before a commit" below).

Identities per folder or per server

If you use one email at work and another in personal projects, rules handle it without you having to remember: "company email in the repositories inside D:\empresa" or "company email in the repositories on gitlab.empresa.com.br, personal email on GitHub". Each rule becomes a file of its own and an [includeIf] block in your global configuration, and git is the one that picks the identity in each repository.

Where to find it

  • Preferences › Identities, Rules group, New rule… button.
  • Palette (Ctrl+P): "Identities…".
  • In the box at the top of Preferences › Identities, in a repository without a rule: Create a rule for gitlab.empresa.com.br….
  • In the warning before a commit and in the suggestion when you open a repository: Create rule….

Step by step

  1. Open Preferences › Identities and click New rule….
  2. In Rule name, give it a short name (for example, Empresa).
  3. In Author name, type the name that appears in the commits; in Email, the rule's email.
  4. In Applies to, choose:
    • A folder ("Every repository inside it (and its subfolders)") and enter the Folder (for example, D:\empresa, or use Choose the folder); or
    • A server ("Repositories whose remote is on it (HTTPS or SSH)") and enter the Server (for example, gitlab.empresa.com.br; you can paste a repository URL). If you want to limit it to a group, fill in Only in this group or organization (optional) (for example, minha-empresa).
  5. (Optional) In Commit signing, choose whether this rule's commits are signed and with which key.
  6. Click Review and save….
  7. The Create the rule "Empresa"? window shows what will be written: "Check what will be written. The rest of the global config (comments, order, other sections) stays as it is." Check the blocks and click Save. The message "Rule "Empresa" saved." confirms it.
FieldWhat it doesDefault
Rule nameName of the rule in the list and in the file (up to 80 characters).—
Author nameuser.name of the rule's repositories.The global name
Emailuser.email of the rule's repositories.—
Applies to: A folderEvery repository inside the folder and its subfolders. "Case-insensitive (gitdir/i). A repository moved out of the folder stops using the rule."Chosen
Applies to: A serverRepositories with any remote on that server, over HTTPS or SSH (git@server:… and ssh://…). Requires git 2.36 or newer.—
Only in this group or organization (optional)Limits the server rule to a group (server/group/…).Empty
Commit signingLeave as is (general config applies), Don't sign commits, one of the keys found (SSH keys (~/.ssh) and GPG keys) or Another key… (with Key and Format).Leave as is

If two rules match the same repository, the one that comes last in the list applies. The box at the top warns: "Matching here: Empresa, Cliente X. The last one in the list applies: Cliente X." In the list, the rule that applies shows applies here; the other one, matches here, but another comes later.

What Versora does in git

Versora writes two files and nothing else:

  1. A file of the rule's own, next to the global configuration (the name comes from the rule name):

    INI
    # Versora identity "Empresa". Edit it in Preferences › Identities.
    # versora-meta: {…}
    [user]
    	name = Ana Souza
    	email = [email protected]
    
  2. [includeIf] blocks at the end of ~/.gitconfig, pointing to that file. In a folder rule:

    INI
    # versora-rule empresa: Versora identity (Preferences › Identities)
    [includeIf "gitdir/i:D:/empresa/"]
    	path = ~/.gitconfig-versora-empresa
    

    In a server rule, one block for each URL form (HTTPS with and without a user, ssh:// with and without a port and the short form git@server:group/project.git):

    INI
    # versora-rule empresa: Versora identity (Preferences › Identities)
    [includeIf "hasconfig:remote.*.url:http*://gitlab.empresa.com.br/**"]
    	path = ~/.gitconfig-versora-empresa
    [includeIf "hasconfig:remote.*.url:http*://*@gitlab.empresa.com.br/**"]
    	path = ~/.gitconfig-versora-empresa
    [includeIf "hasconfig:remote.*.url:ssh://*@gitlab.empresa.com.br/**"]
    	path = ~/.gitconfig-versora-empresa
    …
    

Versora only touches its own lines (the blocks marked with # versora-rule). Comments, order, line endings and the rest of ~/.gitconfig stay as they were. Before replacing the file, it checks the syntax with git itself and uses git's own ~/.gitconfig.lock, so it doesn't run over a git config in progress.

How to undo

There's no Ctrl+Z for rules. You have two ways out:

  • Delete… the rule (see the next section): the blocks are removed and the rule's file is deleted.
  • The backup: before the first change to ~/.gitconfig, Versora saves a copy to ~/.gitconfig.versora-backup ("only this first time"). The Files group in Preferences › Identities shows where it is.

Caveats and messages

  • "Give the rule a name.", "Enter the author name.", "Enter a valid email.", "Choose the folder.", "Enter the server." and "Enter the signing key.": missing fields.
  • "Enter the full folder path (e.g. D:\company), not "…".": the folder must be a full path.
  • ""…" isn't a valid server name (expected something like gitlab.company.com)."
  • ""…" isn't a valid group (use letters, digits, dots, hyphens and / between levels)."
  • "Server rules need Git 2.36 or later, and this is 2.35.1. Older Git silently ignores the condition (the rule never applies). Update Git or use a folder rule." In that case, the Files group shows "no server rules (requires 2.36)".
  • "… is being changed by another program (….lock exists). Wait for it to finish and try again; if nothing else is running, delete ….lock."
  • "The change to … was canceled: git wouldn't be able to read the result.": Versora doesn't write a ~/.gitconfig that git can't read.

See also

Edit, rewrite and delete a rule

Each rule in the list shows the name, the email, the condition and a state. Each rule's buttons are on its own row.

Where to find it

Preferences › Identities, Rules group, on each rule: Edit, Delete… and, when needed, Rewrite….

Step by step

  • Edit: click Edit, change the fields and use Review and save…. The preview is called Save the changes to "Empresa"?.
  • Delete: click Delete…. The Delete the rule "Empresa"? window says "The blocks below are removed from the global config and the file … is deleted." and reminds you that "Repositories that used this rule go back to the global identity (or their own, if they have one)." Confirm with Delete. The message "Rule "Empresa" deleted." confirms it.
  • Rewrite: when the state isn't active, Rewrite… puts the blocks back into ~/.gitconfig.

States of a rule:

StateMeaning
activeEverything is in order.
unlinked"Not in …: the rule doesn't apply anywhere. Rewrite adds the blocks again."
edited by hand"The blocks in … aren't the ones the rule wrote (someone changed them). Rewrite replaces them with the rule's."
file missing"The file … no longer exists: the blocks in the global config point to nothing. Delete the rule to clean them up."
file has errorsThe rule's file can't be read.

What Versora does in git

Editing rewrites the rule's file and, if the condition changed, replaces its blocks in ~/.gitconfig. Deleting removes the blocks and deletes the ~/.gitconfig-versora-<rule> file.

Caveats and messages

  • "The rule's blocks were removed from the global config, but … couldn't be deleted": delete the file by hand.
  • "Rule … no longer exists (or its file has no email).": the rule was deleted outside the app.

Company domain

Tell Versora the domain of your company's emails. With it, in a company repository, it warns you before the commit when the email isn't from the domain. Personal repositories aren't affected.

Where to find it

Preferences › Identities, Company domain group.

Step by step

  1. In Company email domain, type only the domain, for example empresa.com.br.
  2. (Optional) In Other company servers, list the company's git servers whose name doesn't end with the domain, separated by commas (for example, git.empresa-dev.com.br).
  3. Click Save (or Undo to discard).
FieldWhat it doesDefault
Company email domainDomain expected in the emails of company repositories.Empty (off)
Other company serversServers that also count as "company" servers.Empty

A repository is a "company" repository when the remote's server ends with the domain, is in the list of other servers or matches a rule whose email is from the domain.

What Versora does in git

Nothing: it's an app preference.

Caveats and messages

  • "Enter only the domain (e.g. company.com).": no @, no https://.

Identity warning before a commit

Before each commit, Versora checks the identity. If it looks wrong for that repository, it stops and asks, before the other checks (secrets, large files…).

When it appears

  • A rule matches, but another setting overrides it (for example, an old local user.email in .git/config): "The rule "Empresa" matches this repository, but another setting overrides it."
  • Company repository with an outside email (with the company domain configured): "This repository is on gitlab.empresa.com.br, a company server, but the email isn't from the empresa.com.br domain."
  • No identity at all: the Git identity not configured window appears directly (see the last section).

Step by step

  1. You click Commit (or press Ctrl+Enter).
  2. The Before committing: identity window shows The commit would be made as, the email's Source and the expected rule.
  3. Choose:
    • Use the identity of rule "Empresa" in this repository: writes the rule's identity to the local configuration and goes ahead with the commit, already with the right email;
    • Commit anyway: goes ahead with the current identity;
    • Create rule…: when no rule has an email from the domain ("No rule has an email from that domain. Create one so you don't have to remember."); the commit is canceled and the rule editor opens already filled in;
    • Back: cancels the commit.

What Versora does in git

With Use the rule's identity, Versora shows and runs the equivalent commands, for example:

bash
git config --local user.name "Ana Souza"
git config --local user.email [email protected]

After that, the repository has its own identity and no longer follows the rules.

How to undo

To make the repository follow the rules again, turn off its own identity in Preferences › Profile (see "Identity for this repository only" above). The commit already made doesn't change; to change the author of the last commit, use Amend.

Caveats and messages

  • The same Use the identity of rule "Empresa" in this repository exists in the box at the top of Preferences › Identities. There, the Use the rule's identity in loja-online? window shows the Equivalent commands: and reminds you: "To make the repository follow the rules again, turn off its own identity in Preferences › Profile." The button is Write to this repository, and the final message says "This repository now uses [email protected] (rule "Empresa")."

See also

Rule suggestion when you open a repository

When you open a repository whose server doesn't match any rule, and your global email looks like it belongs to another organization, Versora shows a discreet card (not a window): Identity for gitlab.cliente.com.br? "Your global email is [email protected], which looks like it belongs to another organization. Create a rule with the right email for repositories on gitlab.cliente.com.br?"

ButtonWhat it does
Create rule…Opens the server rule editor, already with the server and your name.
Not nowCloses the card. It doesn't come back for that server in this session.
Don't ask againNever suggests a rule for that server again.

The card doesn't appear if the repository already has its own identity or if some rule already matches it.

When the global identity overrides the rules

git reads ~/.gitconfig from top to bottom and keeps the last value it finds. If a name or email appears after the rules' blocks (for example, written by a git config --global user.email … in the terminal), it overrides all the rules.

Step by step

  1. Preferences › Identities shows the The global identity is overriding the rules warning: "In …, a name or email appears after the rules' blocks (for example, written by git config --global), and git keeps the last one it reads."
  2. Click Move the rules to the end….
  3. The Move the rules to the end of the file? window shows the Blocks moved to the end:. Confirm with Move to the end. The message "The rules now come after the global identity." confirms it.

What Versora does in git

It moves the rules' [includeIf] blocks to the end of ~/.gitconfig, with the same conditions. The rest of the file stays as it was.

Git identity not configured

When you try a commit without a name and email (or another operation that creates a commit or an annotated tag, such as merge, revert or cherry-pick), git refuses. Instead of git's message, Versora shows the Git identity not configured window: "Git needs a name and an email to record who made each commit, and no valid identity is configured yet. Set yours in the preferences and try again. Nothing was lost: whatever the operation already applied is still in your pending changes."

Step by step

  1. Click Set up identity. Preferences opens on Profile.
  2. Fill in the global identity (or create a rule) and save.
  3. Go back to the commit box and commit again.

See also