GitLab 명령 및 GitLab에서 코드를 푸시하는 방법

작성자

카테고리:

← 피드로
DEV Community · Adhi sankar · 2026-06-10 개발(SW)

Adhi sankar

Why Use GitLab?

  1. Centralized source code management
  2. Built-in CI/CD pipelines
  3. Issue tracking and project management
  4. Team collaboration and code reviews
  5. Secure repository hosting

Common Git Commands

Check Git Version

git –version

Configure Git Username and Email

git config –global user.name “Your Name”
git config –global user.email “[email protected]

Initialize a Repository

git init

Check Repository Status

git status

Add Files

Add a single file:
git add filename
Add all files:
git add .

Commit Changes

git commit -m “Initial commit”

View Commit History

git log

How to Push Existing Code to GitLab
Step 1: Create a Project in GitLab

  1. Sign in to GitLab.
  2. Click New Project.
  3. Enter the project name.
  4. Click Create Project.

Step 2: Open Terminal in Your Project Folder

cd your-project-folder

Step 3: Initialize Git

git init

Step 4: Add Files

git add .

Step 5: Commit Files

git commit -m “First commit”

Step 6: Connect Local Repository to GitLab
Replace the URL with your GitLab repository URL:

git remote add origin https://gitlab.com/username/project-name.git

Step 7: Push Code to GitLab
For a new repository:

git branch -M main
git push -u origin main

Daily Workflow Commands

git add .
git commit -m “Updated project”
git push

Conclusion

GitLab combined with Git provides a complete platform for version control and collaboration. By learning basic Git commands such as git add, git commit, and git push, developers can efficiently manage code and keep projects synchronized with GitLab repositories. Following a consistent Git workflow improves productivity, code quality, and team collaboration.

원문에서 계속 ↗

코멘트

답글 남기기

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다