test
This commit is contained in:
parent
f243ed4283
commit
69b0906bc0
6 changed files with 392 additions and 0 deletions
63
gitlab/1_prerequisites_gitlab_ubuntu.md
Normal file
63
gitlab/1_prerequisites_gitlab_ubuntu.md
Normal file
|
@ -0,0 +1,63 @@
|
|||
### 📘 `1_prerequisites_gitlab_ubuntu.md`
|
||||
|
||||
````markdown
|
||||
## 📘 `1_prerequisites_gitlab_ubuntu.md`
|
||||
|
||||
### 📌 Purpose
|
||||
|
||||
Prepare your Ubuntu system to create and work with remote GitLab repositories using SSH and CLI tools.
|
||||
|
||||
---
|
||||
|
||||
### ✅ System Requirements
|
||||
|
||||
* **Install Git**
|
||||
|
||||
```bash
|
||||
sudo apt update
|
||||
sudo apt install git -y
|
||||
````
|
||||
|
||||
* **Create a GitLab account**
|
||||
👉 [https://gitlab.com/users/sign\_up](https://gitlab.com/users/sign_up)
|
||||
|
||||
* **Set your Git identity**
|
||||
|
||||
```bash
|
||||
git config --global user.name "Your Name"
|
||||
git config --global user.email "your_email@example.com"
|
||||
```
|
||||
|
||||
* **Generate an SSH key (if not already present)**
|
||||
|
||||
```bash
|
||||
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
|
||||
eval "$(ssh-agent -s)"
|
||||
ssh-add ~/.ssh/id_rsa
|
||||
```
|
||||
|
||||
* **Add your SSH key to GitLab**
|
||||
|
||||
```bash
|
||||
cat ~/.ssh/id_rsa.pub
|
||||
```
|
||||
|
||||
🔗 Copy the output and paste it at:
|
||||
GitLab → Preferences → SSH Keys → *Add key*
|
||||
|
||||
* **Test the connection**
|
||||
|
||||
```bash
|
||||
ssh -T git@gitlab.com
|
||||
```
|
||||
|
||||
✅ You should see something like:
|
||||
|
||||
> Welcome to GitLab, @your-username!
|
||||
|
||||
---
|
||||
|
||||
````
|
||||
|
||||
---
|
||||
|
73
gitlab/2_create_remote_repo_gitlab_ubuntu.md
Normal file
73
gitlab/2_create_remote_repo_gitlab_ubuntu.md
Normal file
|
@ -0,0 +1,73 @@
|
|||
### 📘 `2_create_remote_repo_gitlab_ubuntu.md`
|
||||
|
||||
```markdown
|
||||
## 📘 `2_create_remote_repo_gitlab_ubuntu.md`
|
||||
|
||||
### 📌 Purpose
|
||||
|
||||
Create a new GitLab repository and push your local Ubuntu project to it using the CLI.
|
||||
|
||||
---
|
||||
|
||||
### 🪐 Step-by-Step
|
||||
|
||||
#### Step 1: Install GitLab CLI
|
||||
|
||||
```bash
|
||||
curl -s https://raw.githubusercontent.com/profclems/glab/trunk/scripts/install.sh | sudo bash
|
||||
````
|
||||
|
||||
#### Step 2: Authenticate GitLab CLI
|
||||
|
||||
```bash
|
||||
glab auth login
|
||||
```
|
||||
|
||||
Choose:
|
||||
|
||||
* GitLab.com or custom instance
|
||||
* Paste your **Personal Access Token** when prompted
|
||||
|
||||
---
|
||||
|
||||
#### Step 3: Initialize your project
|
||||
|
||||
```bash
|
||||
mkdir myproject
|
||||
cd myproject
|
||||
git init
|
||||
echo "# My Project" > README.md
|
||||
git add .
|
||||
git commit -m "Initial commit"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
#### Step 4: Create GitLab repository via CLI
|
||||
|
||||
```bash
|
||||
glab repo create myproject --visibility public --confirm
|
||||
```
|
||||
|
||||
This:
|
||||
|
||||
* Creates the GitLab repo
|
||||
* Links it to your local repo
|
||||
* Adds `origin` remote
|
||||
|
||||
---
|
||||
|
||||
#### Step 5: Push to GitLab
|
||||
|
||||
```bash
|
||||
git push -u origin master
|
||||
```
|
||||
|
||||
✅ From now on, `git push` will work as expected.
|
||||
|
||||
---
|
||||
|
||||
````
|
||||
|
||||
---
|
||||
|
53
gitlab/3_commit_existing_repo_gitlab_ubuntu.md
Normal file
53
gitlab/3_commit_existing_repo_gitlab_ubuntu.md
Normal file
|
@ -0,0 +1,53 @@
|
|||
### 📘 `3_commit_existing_repo_gitlab_ubuntu.md`
|
||||
|
||||
```markdown
|
||||
## 📘 `3_commit_existing_repo_gitlab_ubuntu.md`
|
||||
|
||||
### 📌 Purpose
|
||||
|
||||
Work with an existing GitLab repo: clone, edit, commit, and push using Ubuntu.
|
||||
|
||||
---
|
||||
|
||||
### 🛠️ Step-by-Step
|
||||
|
||||
#### Step 1: Clone the repository
|
||||
|
||||
```bash
|
||||
git clone git@gitlab.com:your-username/your-repo.git
|
||||
cd your-repo
|
||||
````
|
||||
|
||||
---
|
||||
|
||||
#### Step 2: Edit files
|
||||
|
||||
```bash
|
||||
nano myfile.txt
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
#### Step 3: Stage and commit
|
||||
|
||||
```bash
|
||||
git add .
|
||||
git commit -m "Your change description"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
#### Step 4: Push your changes
|
||||
|
||||
```bash
|
||||
git push origin master
|
||||
```
|
||||
|
||||
If you use another branch (e.g., `main`, `dev`), substitute accordingly.
|
||||
|
||||
---
|
||||
|
||||
````
|
||||
|
||||
---
|
||||
|
69
gitlab/CLI-ONLY_workflow_gitlab_ubuntu.md
Normal file
69
gitlab/CLI-ONLY_workflow_gitlab_ubuntu.md
Normal file
|
@ -0,0 +1,69 @@
|
|||
### 📘 `CLI-ONLY_workflow_gitlab_ubuntu.md`
|
||||
|
||||
```markdown
|
||||
## 📘 `CLI-ONLY_workflow_gitlab_ubuntu.md`
|
||||
|
||||
### 📌 Purpose
|
||||
|
||||
Set up, initialize, and push a GitLab repo using only the terminal — no browser required.
|
||||
|
||||
---
|
||||
|
||||
### 🪐 Step-by-Step CLI Workflow
|
||||
|
||||
#### 1. Install everything you need
|
||||
|
||||
```bash
|
||||
sudo apt update
|
||||
sudo apt install git curl -y
|
||||
curl -s https://raw.githubusercontent.com/profclems/glab/trunk/scripts/install.sh | sudo bash
|
||||
````
|
||||
|
||||
#### 2. Configure your Git identity
|
||||
|
||||
```bash
|
||||
git config --global user.name "Your Name"
|
||||
git config --global user.email "your_email@example.com"
|
||||
```
|
||||
|
||||
#### 3. Authenticate with GitLab
|
||||
|
||||
```bash
|
||||
glab auth login
|
||||
```
|
||||
|
||||
Use **SSH** and paste your **Personal Access Token** (create one at [https://gitlab.com/-/profile/personal\_access\_tokens](https://gitlab.com/-/profile/personal_access_tokens))
|
||||
|
||||
---
|
||||
|
||||
#### 4. Initialize your project
|
||||
|
||||
```bash
|
||||
mkdir myproject
|
||||
cd myproject
|
||||
git init
|
||||
touch README.md
|
||||
git add .
|
||||
git commit -m "Initial commit"
|
||||
```
|
||||
|
||||
#### 5. Create GitLab repo via CLI
|
||||
|
||||
```bash
|
||||
glab repo create myproject --visibility public --confirm
|
||||
```
|
||||
|
||||
#### 6. Push your changes
|
||||
|
||||
```bash
|
||||
git push -u origin master
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
✅ Done. You've created and linked a GitLab repository entirely from the CLI.
|
||||
|
||||
```
|
||||
|
||||
---
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue