** UPDATE: April 21, 2019 **
Check'em out below.
It's not necessary to remove old origin and create a new one. You can just change the existing origin url:
git remote set-url origin NEW_URL
Instead of creating a new repo, why not just create a fork then set the remote the same way? The git history should be the same, and GitHub will still track it as a forked repository
You git cloned a repository from GitHub without forking it.
The problem is that you made a bunch of changes and want to publish it to a new GitHub repository.
What are the steps required to accomplish it?
Remove original remote and add your own
But when you try to commit the code back to GitHub, you get an error message that you don’t have a permission since the cloned repo belongs to another user.
First, remove the remote repository associated using
git remote rm origin.
Then create your own repository on GitHub.
After creating the repository, copy the repo URL.
Now, add the URL to your repo.
Now you can push/publish it to your own repository!
Wolla! It’s committed to your GitHub repository.
You can simply download a zip version of the repository,
git init, then add the remote yourself if you are uncomfortable with
Git command is very flexible that there might be other ways to do it much easier. Please let me know if there is a way to do it without going through all these troubles 🙂.