mirror of
https://codeberg.org/Codeberg/Documentation.git
synced 2026-06-16 05:13:54 -07:00
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
This commit is contained in:
parent
d7889e5ad6
commit
ccf30d34d6
5 changed files with 34 additions and 10 deletions
|
|
@ -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 deprectated commands can be found on the offical [Git documententation](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 set --global --list
|
||||
```
|
||||
|
||||
{% admonition "tip" %}
|
||||
|
|
|
|||
|
|
@ -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/*'
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 deprectated commands can be found on the offical [Git documententation](https://git-scm.com/docs/git-config#_deprecated_modes).
|
||||
|
||||
{% endadmonition %}
|
||||
|
||||
1. Open your terminal
|
||||
2. Type `git config --global user.signingkey <GPG KEY ID>`
|
||||
3. Type `git config --global commit.gpgsign true`
|
||||
2. Type `git config set --global user.signingkey <GPG KEY ID>`
|
||||
3. Type `git config set --global commit.gpgsign true`
|
||||
|
||||
{% admonition "note" %}
|
||||
|
||||
|
|
|
|||
|
|
@ -175,24 +175,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 deprectated commands can be found on the offical [Git documententation](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/<YOUR PUBLIC SSH KEY>'
|
||||
git config set --global user.signingKey '~/.ssh/<YOUR PUBLIC SSH KEY>'
|
||||
```
|
||||
|
||||
3. Sign commits by default:
|
||||
|
||||
```shell
|
||||
git config --global commit.gpgSign true
|
||||
git config set --global commit.gpgSign true
|
||||
```
|
||||
|
||||
## Avoid re-typing the passphrase
|
||||
|
|
|
|||
Loading…
Reference in a new issue