Git과 GitHub 초보자를 위한 친절한 가이드
Source: Dev.to
Installing Git Bash
- Google Git Bash
- Download the Windows installer
- Run the installer with these recommended settings:
- Select “Use Git from Git Bash only”
Connecting Git to Your GitHub Account
Check Git version
git --versionConfigure Your Identity
git config --global user.name "Your Name"
git config --global user.email "you@example.com"Generate an SSH Key
# Generate a new SSH key
ssh-keygen -t ed25519 -C "you@example.com"The public key will be saved to:
C:\Users\YOUR_USERNAME\.ssh\id_ed25519.pubAdd SSH Key to GitHub
- Go to your GitHub account → Settings → SSH and GPG keys.
- Click “New SSH key”, paste the contents of
id_ed25519.pub, and save.
Test Your Connection
ssh -T git@github.comYou should see a success message confirming authentication.
What Is Git and Why Is Version Control Important?
Git is a free, open‑source distributed version control system (DVCS) used by developers to track changes in source code and other files during software development. It enables multiple people to collaborate on the same project without overwriting each other’s work and allows users to revert to previous versions when needed.
Importance of Version Control
- Keeps a complete history of changes.
- Facilitates collaboration among team members.
- Enables branching and merging for feature development.
- Provides a safety net for recovering lost work.
How to Push Code to GitHub
# Initialize a new repository (if you haven’t already)
git init
# Add your files to Git’s staging area
git add .
# Commit your changes with a message
git commit -m "Initial commit"
# Connect your project to GitHub
git remote add origin https://github.com/username/repository.git
# Push your code to the remote repository
git push -u origin mainHow to Pull Code from GitHub
Pulling downloads the latest changes from GitHub to your local machine:
git pull origin mainHow to Track Changes Using Git
Status: Shows which files are new, modified, or staged.
git statusLog: View commit history with messages, authors, and timestamps.
git logDiff: Compare changes before committing; displays the exact lines added or removed.
git diff