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

2.7k views Asked by At

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?

1

There are 1 answers

0
nurmdrafi On

[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