Git 및 GitHub 시작하기: 초보자를 위한 가이드
Source: Dev.to
Introduction
소프트웨어 개발 세계에서 버전 관리가 필수적입니다. Git은 코드 변경 사항을 추적하는 버전 관리 도구이며, GitHub는 협업을 가능하게 하고 프로젝트를 전시해 줍니다. 이 가이드는 Git Bash를 설정하고 GitHub 계정에 연결하는 방법, 그리고 코드를 푸시하고 풀하는 기본 사항을 안내합니다.
What is Git Bash?
Git Bash는 Windows에서 Unix와 유사한 터미널을 제공하여 Git 명령과 일반 Bash 유틸리티를 사용할 수 있게 해줍니다.
What is GitHub?
GitHub는 Git 저장소를 호스팅하는 클라우드 기반 플랫폼으로, 협업, 이슈 추적 및 프로젝트 전시를 지원합니다.
Why Use Git and GitHub?
- Version Control – 코드의 변화를 시간에 따라 추적합니다.
- Collaboration – 다른 사람들과 원활하게 작업할 수 있습니다.
- Portfolio – 잠재적인 고용주에게 프로젝트를 보여줄 수 있습니다.
Installing Git Bash
- 공식 Git 웹사이트에서 사용 중인 운영 체제를 선택합니다.
- 설치 파일을 다운로드하고 실행합니다.
Verifying Installation
git --version
Configuring Name and Email
# Set your name
git config --global user.name "YourName"
# Set your email
git config --global user.email "YourEmail"
# Verify the configuration
git config --list
Connecting GitHub to Git Bash Using SSH Keys
Generate an SSH Key
# List existing keys (optional)
ls ~/.ssh
# Generate a new Ed25519 key
ssh-keygen -t ed25519 -C "YourEmail"
# Start the ssh-agent
eval "$(ssh-agent -s)"
# Add the private key to the agent
ssh-add ~/.ssh/id_ed25519
Add the SSH Key to GitHub
# Copy the public key to the clipboard (Windows)
clip < ~/.ssh/id_ed25519.pub
- GitHub → Settings → SSH and GPG keys → New SSH key 로 이동합니다.
- 복사한 공개 키를 붙여넣고, 제목을 지정합니다(예: “GitHub Key”). 그리고 Add SSH key 를 클릭합니다.
Test Your Connection
ssh -T git@github.com
인증이 성공했음을 알리는 메시지가 표시됩니다.
Basic Git Commands
# Create a new directory and initialize a repository
mkdir kenya
cd kenya
git init
# Create files
touch nairobi
touch student.py
touch README.md
# Stage all changes
git add .
# (Optional) Return to home directory
cd ~
Conclusion
Git과 Git Bash를 숙달하는 것은 소프트웨어 개발에서 효과적인 버전 관리와 협업을 위해 필수적입니다. 기본 명령을 이해하고 SSH 인증을 설정함으로써 프로젝트를 효율적으로 관리하고 GitHub와 같은 플랫폼에서 다른 사람들의 작업에 기여할 수 있습니다.