How To Redirect A Github Classroom Project Repo To A New Repo On Your Personal Github Account
If you have a class project on your local machine that you accepted through Github Classroom that you'd now like to have on your own personal repository, here are the steps to redirect the origin to a new repo on your personal Github account (these directions assume you already have the project in question cloned to your machine through Github Classroom):
-
Go into your local project folder and open a Gitbash terminal.
-
Enter the command "git remote -v" in Gitbash. You should see something like this:
This shows the current path that is set when you fetch from/push to the remote Github Classroom repo that your local project is currently connected to. We need to reset that to a new personal Github repository (which we will create in the next step) in your Github account.
- To create a new personal Github repository, log into your Github account and in the top righthand corner, click on the plus sign and select "new repository":
- The next screen that pops up is the setup for this new remote repo. You need to give it a name and set the access to public or private. If it's private, no one will be able to see it except people you invite to collaborate. If it's public, anyone can see it and the code. Choose one and click on "Create Repository".
- If you look in your browser address bar, you should be able to copy your remote Github repository url like this:
Now we need to go back into your Gitbash terminal and reset where the project is connected to. Use this command and paste your url into the end of it:
git remote set-url origin <your-new-repo-url>
- After that, if you run the command "git remote -v" again, as in the screenshot below, you should see the origin reset to your new personal remote Github repository url.
Once you add, commit and push, you'll be able to access your repo in your personal Github account like this: