'How to transfer GitHub classroom private repo to my GitHub repo?

I have an assignment project which was created by GitHub Classroom and is also private. So how to transfer my project to my personal account with all existing commits?



Solution 1:[1]

[Step 1]

  1. Go to Github classroom private repo and clone the git URL from [code]

  2. Open cmd from the parent folder

  3. git clone --bare _____(clone URL) [--bare => clone with all commits]

  4. open the cloned folder from explorer

[Step 2]

  1. Create a new repo

  2. Just copy the origin URL

  3. git push --mirror _____(origin url) [--mirror => transfer all commits]

[Step 3]

  1. Change origin [otherwise new code will push to the previous git location]
  2. git remote -v[checking remote version]
  3. git remote set-url origin _____(origin URL)
  4. git remote -v

Examples

git clone --bare https://github.com/your-assignment-project.git

git push --mirror https://github.com/your-personal-repo.git

git remote set-url origin https://github.com/your-personal-repo.git

git remote -v

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 nurmdrafi