# How to install and configure git on a computer
## I - installing git
### macOS
1. Open a terminal and install Xcode Command Line Tools:
```
xcode-select --install
```
Alternatively, you can install the entire [Xcode](https://developer.apple.com/xcode/) package through the macOS App Store.
2. Select Install to download and install Xcode Command Line Tools.
1. Install Homebrew according to the [official Homebrew installation instructions](https://brew.sh/index.html).
1. Install Git by running `brew install git` from your terminal.
1. In a terminal, verify that Git works on your computer:
```
git --version
```
##### macOS update
Periodically you may need to update the version of Git installed by Homebrew. To do so, open a terminal and run these commands:
```
brew update
brew upgrade git
```
To verify you are on the updated version, run git --version to display your current version of Git.
### Ubuntu Linux
On Ubuntu and other Linux operating systems, use the built-in package manager to install Git:
1. Open a terminal and run these commands to install the latest Git from the officially maintained package archives:
```
sudo apt-add-repository ppa:git-core/ppa
sudo apt-get update
sudo apt-get install git
```
2. To verify that Git works on your computer, run:
```
git --version
```
#### Ubuntu Linux Update
Periodically it may be necessary to update Git installed. To do so, run the same commands.
### Windows
Go to the [Git website](https://git-scm.com/), and then download and install Git for Windows [here](https://git-scm.com/download/win).
We now have access to several software packages:
* git GUI
* git CMD
* git Bash
We'll be using git Bash to run git.
* [All materials about installing git on gitlab docs](https://docs.gitlab.com/ee/topics/git/how_to_install_git/)
* [A doc to install git on windows ](https://forge.ird.fr/itrop/formation_admin/ci_septembre2023/-/wikis/git_bash)(N. Tando - UMR DIADE, itrop platform)
## II - Configuring a ssh key after installing Git
Command-line access to git is usually via :
* the https protocol (with login and password)
* or the ssh protocol (with private key).
IRD Forge uses the RENATER identity federation to authenticate users, and therefore does not know their passwords: **==you must therefore use the ssh protocol (with private key)==**.
* [See the tutorial about the creation of a private ssh key on the IRD forge here](https://doc-forge.pages.ird.fr/outils/cli/)
> **_NOTE:_** only the git clone operation of a public repository can be performed without authentication.
## III - First-Time Git Setup
#### Your Identity
The first thing you should do when you install Git is to set your user name and email address. This is important because every Git commit uses this information:
```
git config --global user.name "christine.tranchant_ird.fr"
git config --global user.email "christine.tranchant@ird.fr"
```
## Thanks
* Documentation on  and gitlab
* Ndomassi Tando (UMR DIADE, IRD)
## Authors
Doc compiled by Christine Tranchant-Dubreuil & Julie Orjuela-Bouniol  
## Git repo
https://forge.ird.fr/diade/bioinfonair
## License

This repository is licensed under the Creative Commons Attribution 4.0 International License. To view a copy of this license, [visit here](https://creativecommons.org/licenses/by-nc-sa/4.0/).