Skip to content

Latest commit

 

History

History
43 lines (36 loc) · 753 Bytes

README.md

File metadata and controls

43 lines (36 loc) · 753 Bytes

Duplicate GitHub Repos

Step 1

Change the Remote Origin

git remote add new-origin [email protected]:username/your-new-repo.git

Step 2

Verify the Remote location (optional)

git remote -v

Step 3

Push all branches to the remote repo

git push new-origin --all
git push new-origin --tags

Step 4

Fetch the origin

git fetch origin

Step 5

Create local tracting branches for remote repo

for branch in $(git branch -r | grep 'origin/' | grep -v 'origin/HEAD' | sed 's/origin\///'); do
    git checkout -b "$branch" "origin/$branch"
done

Step 6

Push all branches individually

for branch in $(git branch | sed 's/\* //'); do
    git push new-origin "$branch"
done