2018-03-17 18:26:18 +05:30
|
|
|
---
|
|
|
|
comments: false
|
|
|
|
---
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
# Configure your environment
|
|
|
|
|
|
|
|
## Install
|
|
|
|
|
|
|
|
- **Windows**
|
2019-12-21 20:55:43 +05:30
|
|
|
- Install 'Git for Windows' from <https://gitforwindows.org>
|
2017-08-17 22:00:37 +05:30
|
|
|
|
|
|
|
- **Mac**
|
|
|
|
- Type '`git`' in the Terminal application.
|
|
|
|
- If it's not installed, it will prompt you to install it.
|
|
|
|
|
|
|
|
- **Linux**
|
2019-09-30 21:07:59 +05:30
|
|
|
|
2020-03-09 13:42:32 +05:30
|
|
|
```shell
|
2018-11-20 20:47:30 +05:30
|
|
|
sudo yum install git-all
|
2017-08-17 22:00:37 +05:30
|
|
|
```
|
2019-09-30 21:07:59 +05:30
|
|
|
|
2020-03-09 13:42:32 +05:30
|
|
|
```shell
|
2018-11-20 20:47:30 +05:30
|
|
|
sudo apt-get install git-all
|
2017-08-17 22:00:37 +05:30
|
|
|
```
|
|
|
|
|
|
|
|
## Configure Git
|
|
|
|
|
|
|
|
One-time configuration of the Git client
|
|
|
|
|
2020-03-09 13:42:32 +05:30
|
|
|
```shell
|
2017-08-17 22:00:37 +05:30
|
|
|
git config --global user.name "Your Name"
|
|
|
|
git config --global user.email you@example.com
|
|
|
|
```
|
|
|
|
|
|
|
|
## Configure SSH Key
|
|
|
|
|
2020-03-09 13:42:32 +05:30
|
|
|
```shell
|
2017-08-17 22:00:37 +05:30
|
|
|
ssh-keygen -t rsa -b 4096 -C "you@computer-name"
|
|
|
|
```
|
|
|
|
|
2020-03-09 13:42:32 +05:30
|
|
|
```shell
|
2017-08-17 22:00:37 +05:30
|
|
|
# You will be prompted for the following information. Press enter to accept the defaults. Defaults appear in parentheses.
|
|
|
|
Generating public/private rsa key pair.
|
|
|
|
Enter file in which to save the key (/Users/you/.ssh/id_rsa):
|
|
|
|
Enter passphrase (empty for no passphrase):
|
|
|
|
Enter same passphrase again:
|
|
|
|
Your identification has been saved in /Users/you/.ssh/id_rsa.
|
|
|
|
Your public key has been saved in /Users/you/.ssh/id_rsa.pub.
|
|
|
|
The key fingerprint is:
|
|
|
|
39:fc:ce:94:f4:09:13:95:64:9a:65:c1:de:05:4d:01 you@computer-name
|
|
|
|
```
|
|
|
|
|
|
|
|
Copy your public key and add it to your GitLab profile
|
|
|
|
|
2020-03-09 13:42:32 +05:30
|
|
|
```shell
|
2017-08-17 22:00:37 +05:30
|
|
|
cat ~/.ssh/id_rsa.pub
|
|
|
|
```
|
|
|
|
|
2020-03-09 13:42:32 +05:30
|
|
|
```shell
|
2017-08-17 22:00:37 +05:30
|
|
|
ssh-rsa AAAAB3NzaC1yc2EAAAADAQEL17Ufacg8cDhlQMS5NhV8z3GHZdhCrZbl4gz you@example.com
|
|
|
|
```
|