From 1ef2d6fae7fb32b7c7ac2530d7cc27eade9671df Mon Sep 17 00:00:00 2001 From: jarrodlovas Date: Thu, 25 Jun 2026 21:31:22 +0200 Subject: [PATCH] docs: Updated git config command examples, outlining those commands have changed and also added a warning for users to consider migrating to the new command syntax (#802) 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 --- content/git/configuring-git.md | 14 +++++++++++--- content/git/reduce-size.md | 2 +- content/security/2fa.md | 2 +- content/security/gpg-key.md | 12 ++++++++++-- content/security/ssh-key.md | 14 +++++++++++--- 5 files changed, 34 insertions(+), 10 deletions(-) diff --git a/content/git/configuring-git.md b/content/git/configuring-git.md index 083048a..7a3aaee 100644 --- a/content/git/configuring-git.md +++ b/content/git/configuring-git.md @@ -8,9 +8,17 @@ eleventyNavigation: 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 --global user.name 'knut' -git config --global user.email 'knut@example.com' +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. @@ -18,7 +26,7 @@ This is because the email address will later be used to assign your commits to y To verify that you've set up everything properly, run: ```bash -git config --global --list +git config list --global ``` {% admonition "tip" %} diff --git a/content/git/reduce-size.md b/content/git/reduce-size.md index ecb1336..2f1e915 100644 --- a/content/git/reduce-size.md +++ b/content/git/reduce-size.md @@ -128,7 +128,7 @@ to undo in case anything goes wrong. 1. Turn off the mirror flag and carry out force pushes to your remote ```shell - git config --unset remote.origin.mirror + git config unset remote.origin.mirror git push origin --force 'refs/heads/*' git push origin --force 'refs/tags/*' git push origin --force 'refs/replace/*' diff --git a/content/security/2fa.md b/content/security/2fa.md index c39cecf..3376f66 100644 --- a/content/security/2fa.md +++ b/content/security/2fa.md @@ -142,7 +142,7 @@ If you want to permanently save your generated access token you can use the foll your computer: ```bash -git config --global credential.helper cache +git config set --global credential.helper cache ``` ## Troubleshooting diff --git a/content/security/gpg-key.md b/content/security/gpg-key.md index fc83b9c..13c3536 100644 --- a/content/security/gpg-key.md +++ b/content/security/gpg-key.md @@ -85,9 +85,17 @@ you can sign the provided message. If the signed message is valid, Codeberg can You will need to tell Git about your key and have it sign new commits for you. +{% 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 %} + 1. Open your terminal -2. Type `git config --global user.signingkey ` -3. Type `git config --global commit.gpgsign true` +2. Type `git config set --global user.signingkey ` +3. Type `git config set --global commit.gpgsign true` {% admonition "note" %} diff --git a/content/security/ssh-key.md b/content/security/ssh-key.md index e8ec3b9..ee68715 100644 --- a/content/security/ssh-key.md +++ b/content/security/ssh-key.md @@ -170,24 +170,32 @@ To update your version of Git,see the [Git](https://git-scm.com/downloads) websi {% endadmonition %} +{% 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 %} + In your terminal, run the following commands: 1. Make git use SSH to sign commits and tags: ```shell -git config --global gpg.format ssh +git config set --global gpg.format ssh ``` 2. Set the SSH signing key to your public key: ```shell -git config --global user.signingKey '~/.ssh/' +git config set --global user.signingKey '~/.ssh/' ``` 3. Sign commits by default: ```shell -git config --global commit.gpgSign true +git config set --global commit.gpgSign true ``` ## Avoid re-typing the passphrase