mirror of
https://codeberg.org/Codeberg/Documentation.git
synced 2026-07-04 09:45:45 -07:00
Updated git config syntax and added a warning for users that it's recommended to migrate to the new syntax. This was suggested in issue #756. Closes: #756 Reviewed-on: https://codeberg.org/Codeberg/Documentation/pulls/802 Reviewed-by: Robert Wolff <mahlzahn@posteo.de>
41 lines
1.5 KiB
Markdown
41 lines
1.5 KiB
Markdown
---
|
|
eleventyNavigation:
|
|
key: ConfiguringGit
|
|
title: Configuring Git
|
|
parent: Git
|
|
---
|
|
|
|
Once you've managed to get Git up and running, the first thing you must do before you can use your fresh installation of
|
|
Git is to tell Git your name and email address. You only have to do this once; this is easily done with:
|
|
|
|
{% admonition "warning" %}
|
|
|
|
Starting from git version 2.46, multiple `git config` commands have changed and it's recommended to migrate to the new command syntax. The command examples below have been updated to the new command syntax.
|
|
|
|
A complete list of deprecated commands can be found on the official [Git documentation](https://git-scm.com/docs/git-config#_deprecated_modes).
|
|
|
|
{% endadmonition %}
|
|
|
|
```bash
|
|
git config set --global user.name 'knut'
|
|
git config set --global user.email 'knut@example.com'
|
|
```
|
|
|
|
The username can be anything, but it is important that the email is the same as the one you use on Codeberg.
|
|
This is because the email address will later be used to assign your commits to your account.
|
|
To verify that you've set up everything properly, run:
|
|
|
|
```bash
|
|
git config list --global
|
|
```
|
|
|
|
{% admonition "tip" %}
|
|
|
|
If you don't want to include your email address with your commits, you can opt to specify `USERNAME@noreply.codeberg.org`
|
|
here instead, where USERNAME is your Codeberg username.
|
|
|
|
{% endadmonition %}
|
|
|
|
If you ever want to change your name or email address, simply run the corresponding command again.
|
|
You could also omit the `--global` flag to set a username and email address only for the Git repository you're
|
|
currently in.
|