All about Git - paulip114/blog GitHub Wiki
從 Git repository 下載 repo 的方法
git clone
(recommended)
Option A: 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
- Unzip the folder (e.g.
image2video-main
) - Initialize Git + set remote origin
cd image2video-main
git init
git remote add origin https://github.com/your-username/your-repo.git
- Fetch the original repo's history
git fetch origin
- Create a branch from the real origin history
git checkout -b mac-paul origin/main
- 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 |