Git 및 Github 사용하기

발행: (2026년 2월 13일 오전 10:06 GMT+9)
6 분 소요
원문: Dev.to

Source: Dev.to

Working With Git And Github의 커버 이미지

Maxwell Wokocha C.

Git이란?

Git은 무료이자 오픈‑소스인 분산 버전‑컨트롤 시스템입니다. 파일 집합의 변경 사항을 추적하며, 주로 소스‑코드 프로젝트에서 협업하는 프로그래머들 사이에 작업을 조정하는 데 가장 많이 사용됩니다.

필수 Git 명령

CommandDescription
git push로컬 저장소 내용을 원격 저장소에 업로드합니다.
git commit -m ""설명 메시지를 포함하여 저장소의 스냅샷을 기록합니다.
git add <file>작업 디렉터리의 변경 사항을 다음 커밋을 위해 스테이징합니다.
git remote add origin <url>새 원격 저장소(보통 GitHub)를 등록합니다.
git remote -v현재 원격 URL 목록을 표시합니다.
git config --list현재 Git 설정을 보여줍니다.

Note: 저장소의 원격 URL이 필요하며, 필요할 경우 인증 자격 증명이 필요합니다.

로컬 환경에서 GitHub로 푸시하는 방법

  1. Git Bash 다운로드 – OS와 호환되는 버전을 선택하세요.
  2. Git Bash 설정 – Git에 본인의 신원을 알려줍니다.
  3. 설정된 환경에서 작업하기 – 프로젝트 폴더를 만들고, 저장소를 초기화하는 등.
  4. GitHub 저장소 클론 – 기존 원격 저장소를 로컬로 가져옵니다.
  5. GitHub에 푸시 – 로컬 커밋을 원격에 전송합니다.
  6. 내용 확인 – 모든 것이 정상인지 확인합니다.

1️⃣ Git Bash 다운로드

공식 사이트에서 최신 Git for Windows를 설치하세요:

2️⃣ Git Bash 설정 (신원 지정)

# Set your name (replace <name> with your actual name)
git config --global user.name ""

# Set your email (replace <email> with your actual email)
git config --global user.email ""

Setting user name in Git Bash

Setting user email in Git Bash

# Verify the configuration
git config --list

Git configuration list output

3️⃣ 설정된 환경에서 작업하기

# Create a directory for your project
mkdir website
# Enter the directory
cd website
# Initialise a new Git repository
git init
# Check the repository status
git status

Creating a directory and entering it

Git init output

# Create an index.html file
touch index.html
# Open it with vim (or any editor you prefer)
vim index.html

Creating index.html

vim에서는 i를 눌러 Insert 모드로 들어가 파일을 편집한 뒤, Esc를 누르고 :wq를 입력해 저장하고 종료합니다.

4️⃣ 추가, 커밋 및 푸시

# Stage the new file
git add index.html
# Commit with a message
git commit -m "Add initial index.html"
# Add the remote repository (replace <url> with your GitHub repo URL)
git remote add origin 
# Push the commit to the remote master/main branch
git push -u origin master   # or `main` if your default branch is named main

5️⃣ GitHub에서 확인

GitHub에서 저장소 페이지를 열어 index.html이 파일 목록에 나타나는지 확인하세요.

코딩 즐겁게! 🎉
문제가 발생하면 원격 URL을 다시 확인하고, 자격 증명(SSH 키 또는 개인 액세스 토큰)이 올바르게 설정되어 있는지 확인하세요.

Source:

GitHub 저장소 복제하기

  1. Go to your GitHub page – click the + button and select New repository.

    새 저장소 만들기 화면

  2. Initialize the repository (add a README, .gitignore, license, etc.) and click Create repository.

    저장소 설정 화면

  3. Copy the HTTPS URL

    On the next page click CodeHTTPS and copy the URL that appears.

    HTTPS URL 복사

  4. Clone the repository locally

    Open Git Bash (or your preferred terminal) and run:

    git remote add origin 

    원격 origin 추가 명령

GitHub에 푸시하기

우리는 스테이징 영역에 추가한 index.html 파일을 이동시키고, 커밋한 뒤, 원격 저장소에 푸시해야 합니다.

  1. 상태 확인

    git status

    스테이징 전 Git 상태

  2. 파일 스테이징

    git add index.html

    Git add index.html

  3. 스테이징 확인

    git status

    파일 이름이 녹색으로 표시되어 스테이징 되었음을 나타냅니다.

    스테이징 후 Git 상태

  4. 변경 커밋

    git commit -m "Add index.html"

    Git 커밋 스크린샷

  5. GitHub에 푸시

    git push origin master

    Git 푸시 스크린샷

내용 보기

GitHub Pages URL(또는 저장소의 원시 파일 보기)을 열어 index.html이 이제 라이브 상태인지 확인하세요.

GitHub Pages 보기

모든 이미지는 원본 출처를 유지합니다; 가독성을 위해 마크다운 구조만 정리되었습니다.

감사 이미지

시간을 내어 주셔서 감사합니다. 다음 포스트에서 뵙겠습니다.

0 조회
Back to Blog

관련 글

더 보기 »

PQP 언어

개요 이름: PQP Language 설명: 언어를 구축하는 과정이 어떻게 작동하는지를 보여주기 위해 만든 미니 프로그래밍 언어입니다. !pichttps://med...