git: fix dir name
This commit is contained in:
161
Code-Management/Git/main.md
Normal file
161
Code-Management/Git/main.md
Normal file
@@ -0,0 +1,161 @@
|
||||
# Git Commands Guide
|
||||
|
||||
## Getting Started with Git
|
||||
|
||||
### 1. Installing Git
|
||||
|
||||
Before you begin, ensure Git is installed on your machine. You can download it from [git-scm.com](https://git-scm.com/).
|
||||
|
||||
### 2. Check Git Installation
|
||||
|
||||
To verify that Git is installed, run:
|
||||
|
||||
```bash
|
||||
git --version
|
||||
```
|
||||
|
||||
### 3. Configure Git User Information
|
||||
|
||||
Set up your name and email address, which will be used for your commits:
|
||||
|
||||
```bash
|
||||
git config --global user.name "Your Name"
|
||||
git config --global user.email "your.email@example.com"
|
||||
```
|
||||
|
||||
## Configuring Git to Use a Custom SSH Key
|
||||
|
||||
If you need to use a specific SSH key for your Git operations, you can configure Git as follows:
|
||||
|
||||
```bash
|
||||
git config --add --local core.sshCommand 'ssh -i <PATH_TO_SSH_KEY>'
|
||||
```
|
||||
|
||||
For Clone With Custom SSH Key Use:
|
||||
```bash
|
||||
git -c core.sshCommand="ssh -i <key-path>" clone host:repo
|
||||
```
|
||||
|
||||
|
||||
*Replace `<PATH_TO_SSH_KEY>` with the actual path to your SSH key file.*
|
||||
|
||||
## Creating and Managing a Local Git Repository
|
||||
|
||||
### 1. Initialize a Git Repository
|
||||
|
||||
Start by creating a new Git repository in your local project directory:
|
||||
|
||||
```bash
|
||||
git init -b main
|
||||
```
|
||||
|
||||
*The `-b main` flag sets the default branch name to "main".*
|
||||
|
||||
### 2. Add Files and Commit Changes
|
||||
|
||||
Next, stage all your files and create your initial commit:
|
||||
|
||||
```bash
|
||||
git add -A
|
||||
git commit -m "Initial Commit"
|
||||
```
|
||||
|
||||
*The `git add -A` command stages all changes, while the `git commit` command records those changes with a descriptive message.*
|
||||
|
||||
### 3. Connect to a Remote Repository
|
||||
|
||||
Now, link your local repository to a remote GitHub repository:
|
||||
|
||||
```bash
|
||||
git remote add origin <Repo-Link>
|
||||
```
|
||||
|
||||
*Replace `<Repo-Link>` with the URL of your GitHub repository.*
|
||||
|
||||
### 4. Push Changes to GitHub
|
||||
|
||||
Finally, push your initial commit to the remote repository:
|
||||
|
||||
```bash
|
||||
git push origin main
|
||||
```
|
||||
|
||||
## Common Git Commands for Beginners
|
||||
|
||||
### 1. Check the Status of Your Repository
|
||||
|
||||
To see which changes are staged, unstaged, or untracked:
|
||||
|
||||
```bash
|
||||
git status
|
||||
```
|
||||
|
||||
### 2. View Commit History
|
||||
|
||||
To view the commit history of your repository:
|
||||
|
||||
```bash
|
||||
git log
|
||||
```
|
||||
|
||||
*You can press `q` to exit the log view.*
|
||||
|
||||
### 3. Viewing Changes
|
||||
|
||||
To see changes made to files before staging them:
|
||||
|
||||
```bash
|
||||
git diff
|
||||
```
|
||||
|
||||
### 4. Staging Individual Files
|
||||
|
||||
If you want to stage specific files instead of all changes:
|
||||
|
||||
```bash
|
||||
git add <filename>
|
||||
```
|
||||
|
||||
*Replace `<filename>` with the name of the file you wish to stage.*
|
||||
|
||||
### 5. Undoing Changes
|
||||
|
||||
To unstage a file that you added by mistake:
|
||||
|
||||
```bash
|
||||
git reset <filename>
|
||||
```
|
||||
|
||||
To discard changes in a file and revert it to the last committed state:
|
||||
|
||||
```bash
|
||||
git checkout -- <filename>
|
||||
```
|
||||
|
||||
### 6. Cloning a Repository
|
||||
|
||||
If you want to create a copy of an existing remote repository:
|
||||
|
||||
```bash
|
||||
git clone <Repo-Link>
|
||||
```
|
||||
|
||||
*Replace `<Repo-Link>` with the URL of the repository you want to clone.*
|
||||
|
||||
### 7. Creating a New Branch
|
||||
|
||||
To create a new branch for development:
|
||||
|
||||
```bash
|
||||
git checkout -b <branch-name>
|
||||
```
|
||||
|
||||
*Replace `<branch-name>` with your desired branch name.*
|
||||
|
||||
### 8. Merging Branches
|
||||
|
||||
To merge changes from another branch into your current branch:
|
||||
|
||||
```bash
|
||||
git merge <branch-name>
|
||||
```
|
||||
0
Code-Management/Gitlab/Gitlab-CI/1.md
Normal file
0
Code-Management/Gitlab/Gitlab-CI/1.md
Normal file
25
Code-Management/Gitlab/Gitlab-CI/gitlab-ci.yaml
Normal file
25
Code-Management/Gitlab/Gitlab-CI/gitlab-ci.yaml
Normal file
@@ -0,0 +1,25 @@
|
||||
job1:
|
||||
stage: hello_stage
|
||||
script: echo "Hi :)"
|
||||
|
||||
job2:
|
||||
stage: hello_stage
|
||||
script: echo "Hello :)"
|
||||
|
||||
job3:
|
||||
stage: hello_stage
|
||||
script: echo "How Are You :)"
|
||||
needs:
|
||||
- job2
|
||||
|
||||
Build_job1:
|
||||
stage: build_stage
|
||||
script: echo "Building Code"
|
||||
needs:
|
||||
- job3
|
||||
tags:
|
||||
- build_runner
|
||||
|
||||
stages:
|
||||
- hello_stage
|
||||
- build_stage
|
||||
88
Code-Management/Gitlab/Install/baremetal.md
Normal file
88
Code-Management/Gitlab/Install/baremetal.md
Normal file
@@ -0,0 +1,88 @@
|
||||
# Setting Up GitLab CE on Ubuntu
|
||||
|
||||
Follow the steps below to install and configure GitLab Community Edition (CE) on your Ubuntu system.
|
||||
|
||||
---
|
||||
|
||||
## Step 1: Update the System
|
||||
Ensure your package lists are up-to-date:
|
||||
```bash
|
||||
sudo apt update
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Step 2: Install Dependencies
|
||||
Install required packages for GitLab:
|
||||
```bash
|
||||
sudo apt install -y ca-certificates curl openssh-server postfix tzdata perl
|
||||
```
|
||||
|
||||
- **ca-certificates**: Ensures proper SSL certificate handling.
|
||||
- **curl**: For downloading files.
|
||||
- **openssh-server**: For SSH-based Git operations.
|
||||
- **postfix**: Mail transport agent for email notifications.
|
||||
- **tzdata**: Time zone data.
|
||||
- **perl**: Required by GitLab scripts.
|
||||
|
||||
During the installation, configure **Postfix** to match your mail setup. If unsure, select "Internet Site" and provide your domain.
|
||||
|
||||
---
|
||||
|
||||
## Step 3: Add GitLab's Repository
|
||||
Download and run the repository setup script:
|
||||
```bash
|
||||
curl -LO https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh
|
||||
sudo bash script.deb.sh
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Step 4: Install GitLab CE
|
||||
Install the GitLab CE package:
|
||||
```bash
|
||||
sudo apt install -y gitlab-ce
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Step 5: Configure GitLab
|
||||
Edit the GitLab configuration file to match your environment:
|
||||
```bash
|
||||
sudo vim /etc/gitlab/gitlab.rb
|
||||
```
|
||||
|
||||
- Modify the `external_url` setting to your desired domain or IP.
|
||||
|
||||
Save and exit the editor.
|
||||
|
||||
---
|
||||
|
||||
## Step 6: Apply the Configuration
|
||||
Reconfigure GitLab to apply the changes:
|
||||
```bash
|
||||
sudo gitlab-ctl reconfigure
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Step 7: Retrieve the Initial Root Password
|
||||
After configuration, retrieve the initial root password:
|
||||
```bash
|
||||
sudo cat /etc/gitlab/initial_root_password
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Notes
|
||||
- The default admin username is `root`.
|
||||
- Save the password securely and change it after the first login.
|
||||
|
||||
---
|
||||
|
||||
## Troubleshooting
|
||||
- If you encounter issues, consult the [GitLab Documentation](https://docs.gitlab.com) or check logs in `/var/log/gitlab`.
|
||||
|
||||
---
|
||||
|
||||
Enjoy using GitLab CE!
|
||||
Reference in New Issue
Block a user