Skip to content

Commit e493e0d

Browse files
Update git.mdx
1 parent 756e009 commit e493e0d

File tree

1 file changed

+171
-0
lines changed

1 file changed

+171
-0
lines changed

git.mdx

Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
---
2+
title: "Git installation"
3+
description: "Install Git to manage version control for your documentation"
4+
icon: "git-branch"
5+
---
6+
7+
Git is a distributed version control system that helps you track changes in your documentation files and collaborate with others.
8+
9+
## Installing Git
10+
11+
<Info>
12+
**Prerequisite**: Git installation varies by operating system. Choose the method that matches your system.
13+
</Info>
14+
15+
<Steps>
16+
<Step title="Choose your operating system">
17+
Select the installation method for your operating system:
18+
19+
<Tabs>
20+
<Tab title="Windows">
21+
Download and install Git from the official website:
22+
23+
1. Visit [git-scm.com](https://git-scm.com/download/win)
24+
2. Download the installer for Windows
25+
3. Run the installer and follow the setup wizard
26+
4. Accept the default settings unless you have specific preferences
27+
</Tab>
28+
29+
<Tab title="macOS">
30+
You can install Git using several methods:
31+
32+
**Using Homebrew (recommended):**
33+
```bash
34+
brew install git
35+
```
36+
37+
**Using Xcode Command Line Tools:**
38+
```bash
39+
xcode-select --install
40+
```
41+
42+
**Using the installer:**
43+
1. Visit [git-scm.com](https://git-scm.com/download/mac)
44+
2. Download and run the installer
45+
</Tab>
46+
47+
<Tab title="Linux">
48+
Install Git using your distribution's package manager:
49+
50+
**Ubuntu/Debian:**
51+
```bash
52+
sudo apt update
53+
sudo apt install git
54+
```
55+
56+
**CentOS/RHEL/Fedora:**
57+
```bash
58+
sudo yum install git
59+
# or for newer versions
60+
sudo dnf install git
61+
```
62+
63+
**Arch Linux:**
64+
```bash
65+
sudo pacman -S git
66+
```
67+
</Tab>
68+
</Tabs>
69+
</Step>
70+
71+
<Step title="Verify the installation">
72+
Open your terminal or command prompt and run:
73+
74+
```bash
75+
git --version
76+
```
77+
78+
You should see output similar to:
79+
```
80+
git version 2.39.0
81+
```
82+
</Step>
83+
84+
<Step title="Configure Git (first-time setup)">
85+
Set your name and email address for Git commits:
86+
87+
```bash
88+
git config --global user.name "Your Name"
89+
git config --global user.email "[email protected]"
90+
```
91+
92+
<Info>
93+
Use the same email address associated with your GitHub, GitLab, or other Git hosting service account.
94+
</Info>
95+
</Step>
96+
</Steps>
97+
98+
## Basic Git commands
99+
100+
Once Git is installed, here are some essential commands to get you started:
101+
102+
### Initialize a repository
103+
```bash
104+
git init
105+
```
106+
107+
### Clone a repository
108+
```bash
109+
git clone https://github.com/username/repository.git
110+
```
111+
112+
### Check repository status
113+
```bash
114+
git status
115+
```
116+
117+
### Add files to staging
118+
```bash
119+
git add filename.mdx
120+
# or add all files
121+
git add .
122+
```
123+
124+
### Commit changes
125+
```bash
126+
git commit -m "Your commit message"
127+
```
128+
129+
### Push changes to remote repository
130+
```bash
131+
git push origin main
132+
```
133+
134+
## Troubleshooting
135+
136+
<AccordionGroup>
137+
<Accordion title="Command 'git' not found">
138+
This means Git is not installed or not in your system's PATH.
139+
140+
**Solution**:
141+
1. Reinstall Git following the steps above
142+
2. Restart your terminal or command prompt
143+
3. On Windows, make sure Git was added to your PATH during installation
144+
</Accordion>
145+
146+
<Accordion title="Permission denied (publickey)">
147+
This error occurs when trying to push to a remote repository without proper authentication.
148+
149+
**Solution**:
150+
1. Set up SSH keys for your Git hosting service
151+
2. Or use HTTPS with your username and password/token
152+
3. Check your repository's remote URL with `git remote -v`
153+
</Accordion>
154+
155+
<Accordion title="Git commands are slow on Windows">
156+
This can happen due to Windows Defender or antivirus software scanning.
157+
158+
**Solution**:
159+
1. Add your Git repositories folder to Windows Defender exclusions
160+
2. Consider using Git Bash instead of Command Prompt
161+
3. Enable Git's built-in file system cache: `git config --global core.preloadindex true`
162+
</Accordion>
163+
</AccordionGroup>
164+
165+
## Next steps
166+
167+
Now that you have Git installed, you can:
168+
- Initialize a Git repository for your documentation
169+
- Connect to remote repositories like GitHub or GitLab
170+
- Start tracking changes to your documentation files
171+
- Collaborate with team members on documentation projects

0 commit comments

Comments
 (0)