Documentation/content/getting-started/install-git.md

104 lines
5.7 KiB
Markdown
Raw Normal View History

2020-09-22 14:29:00 +00:00
---
eleventyNavigation:
key: InstallGit
title: Install Git
parent: GettingStarted
2020-09-23 08:09:58 +00:00
order: 25
2020-09-22 14:29:00 +00:00
---
2020-09-23 08:09:58 +00:00
Projects on Codeberg use [Git](https://git-scm.com/) as their [version control](https://git-scm.com/book/en/v2/Getting-Started-About-Version-Control) system. If you want to contribute sourcecode, it is a good idea to install Git at this point.
2020-09-22 14:29:00 +00:00
2020-09-23 08:09:58 +00:00
Git runs on every OS. You can download it directly from the [Git website](https://git-scm.com/downloads), or from your operating systems package manager (if available).
2020-09-22 14:29:00 +00:00
Here we provide step-by-step instructions to install it.
**Disclaimer**: we try to keep these instructions up-to-date, but you might need to adjust them to your machine/OS.
## Windows 10
2020-09-28 10:09:56 +00:00
There are several possibilities to install Git on Windows. An easy one is to use Gits install wizard, shown here.
2020-09-22 14:29:00 +00:00
### Admin or user?
2020-09-23 08:09:58 +00:00
For some Git clients (see [below](#git-clients)), e.g. [RStudio](https://rstudio.com/), it is recommended to install Git as administrator on your machine. It is also possible to install as regular user, but you might have to manually specify the path to the Git executable in the settings of your Git client.
2020-09-22 14:29:00 +00:00
### Install
2020-09-23 08:09:58 +00:00
If you want to install as regular user, just log in with your user account and run the installer.
To install with administrator rights, either log in as administrator, or run the installer as administrator. In the latter case, right-click on the installer, select `Run as administrator` and enter your credentials:
2020-09-28 08:25:25 +00:00
<picture>
2020-09-28 10:09:56 +00:00
<source srcset="/assets/images/getting-started/install-git/win-run-as-admin.webp" type="image/webp">
<img src="/assets/images/getting-started/install-git/win-run-as-admin.png" alt="win-run-admin">
2020-09-28 08:25:25 +00:00
</picture>
2020-09-22 14:29:00 +00:00
2020-09-23 08:09:58 +00:00
From there, follow the steps in the setup wizard. It is okay to just accept the defaults, when in doubt.
2020-09-22 14:29:00 +00:00
There are two steps for which you have to pay attention:
1. Choose your editor:
2020-09-28 10:09:56 +00:00
By default, [Vim](https://www.vim.org/) will be used for Git. But if you prefer to use another one, select it here.
2020-09-28 08:25:25 +00:00
<picture>
2020-09-28 10:09:56 +00:00
<source srcset="/assets/images/getting-started/install-git/win-editor.webp" type="image/webp">
<img src="/assets/images/getting-started/install-git/win-editor.png" alt="win-editor">
2020-09-28 08:25:25 +00:00
</picture>
2020-09-22 14:29:00 +00:00
2. PATH environment:
2020-09-28 10:09:56 +00:00
2020-09-28 08:25:25 +00:00
<picture>
2020-09-28 10:09:56 +00:00
<source srcset="/assets/images/getting-started/install-git/win-path.webp" type="image/webp">
<img src="/assets/images/getting-started/install-git/win-path.png" alt="win-path">
2020-09-28 08:25:25 +00:00
</picture>
2020-09-28 10:09:56 +00:00
2020-09-23 08:09:58 +00:00
This makes sure that Git can be used by 3rd party software (Git clients). It is recommended (and the default) anyway.
> You may get the error message displayed below, that the release notes cannot be displayed. That error message can be safely ignored. You can find the release notes in `Start Menu > Git > Git Release Notes`.
2020-09-28 10:09:56 +00:00
>
> <picture>
> <source srcset="/assets/images/getting-started/install-git/win-error-notes.webp" type="image/webp">
> <img src="/assets/images/getting-started/install-git/win-error-notes.PNG" alt="win-error">
> </picture>
2020-09-22 14:29:00 +00:00
### Run
2020-09-23 08:09:58 +00:00
Git can be used through the `Command Prompt` (the traditional Windows command line interpreter), the `Windows Powershell` (the "replacement" of the `Command Prompt`), the interface of your Git client, or `Git Bash`. The latter two options are recommended.
2020-09-22 14:29:00 +00:00
`Git Bash` is what comes with your Git installation. You can access it from the Start Menu: `Git > Git Bash`.
### Configure
2020-09-23 08:09:58 +00:00
You now 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 `Git Bash`:
2020-09-22 14:29:00 +00:00
```bash
2020-09-28 10:09:56 +00:00
git config --global user.name 'knut'
2020-09-29 12:13:24 +00:00
git config --global user.email 'knut@example.com'
2020-09-22 14:29:00 +00:00
git config --global --list
```
The username can be anything, but it is important that the email is the same as the one you use on Codeberg.
2020-09-23 08:09:58 +00:00
The first time you push/pull (see [Clone & Commit via HTTP](/git/clone-commit-via-http)), it will ask for your Codeberg credentials. If you did not change this setting during installation, these credentials will be saved by Windows in its [Credential Manager](https://support.microsoft.com/en-us/help/4026814/windows-accessing-credential-manager). This is also where you have to go in order to change them.
2020-09-22 14:29:00 +00:00
### Update
2020-09-23 08:09:58 +00:00
To update Git, the easiest way is to download and run the latest version of the installer and follow the previous steps. Make sure that you run the new installer with the same rights (administrator or user) as for the original installation. If not, it will be installed twice and that will create a mess.
If you want to keep all your settings, simply tick the box `Only show new options` in the installation wizard (see screenshots above). Here, "new options" refer to the options that were not available in the previous version.
2020-09-22 14:29:00 +00:00
## macOS
2020-10-03 10:13:13 +00:00
There are several possibilities to install Git on macOS. This guide will show you how to install Git using the Homebrew package manager. You will need to be on macOS High Sierra (10.13) or higher.
2020-09-22 14:29:00 +00:00
2020-10-03 10:13:13 +00:00
### Install
You will first need to install Homebrew. You can do this following the instructions on their [website](https://brew.sh/).
Once you've installed Homebrew, you can install Git from your terminal using the following command.
```bash
% brew install git
```
### Update
To update Git, run the following command.
```bash
% brew upgrade git
```
## Linux
On Linux, you can install Git directly from your package manager. Check out [Git's official documentation](https://git-scm.com/download/linux) for the right command for your distro.
2020-09-22 14:29:00 +00:00
2020-09-23 08:09:58 +00:00
<a name="git-clients"></a>
2020-09-22 14:29:00 +00:00
## Git clients
2020-09-23 08:09:58 +00:00
Git can be used from the command line as shown above, but it can also be used through graphical user interfaces called *Git clients*.
You can find a list of some of the available Git clients on the [Git website](https://git-scm.com/downloads/guis).