All about Git - paulip114/blog GitHub Wiki

從 Git repository 下載 repo 的方法

Option A: git clone (recommended)

git clone https://github.com/your-username/your-repo.git
cd your-repo

This gives you history, branches, remote, everything ready to go.


Option B: Download zip file from repository

  1. Unzip the folder (e.g. image2video-main)
  2. Initialize Git + set remote origin
cd image2video-main
git init
git remote add origin https://github.com/your-username/your-repo.git
  1. Fetch the original repo's history
git fetch origin
  1. Create a branch from the real origin history
git checkout -b mac-paul origin/main
  1. Now your branch is correctly linked, and you can:
# Add and commit your changes
git add .
git commit -m "Your changes"

# Push to GitHub
git push origin mac-paul

Action What Happens Fix
Cloned → ✅ All Git history and remote info preserved Just create a new branch
Downloaded ZIP → ⚠️ No history or remote You must reattach it to the repo using git remote add origin and git fetch