Welcome to this section of my quick guides. This is a quick guide on how to disconnect your local git repository from the remote master.
Please read through to the end to find the best option that works for you.
First, run this command in your project root folder to ensure your project is connected to a GitHub repository.
git remote
If you see something like origin , you are set.
run this command as well.
git remote -v
You will see the push and pull links to your remote repos as below.
Option one
To link your local repository to another repository, you need to get the URL to the new repository and run this command
git remote set-url origin git://new.url.here
or
git remote set-url --push origin https://newurl
or
git remote set-url origin https://newurl
Any of these should work.
Run this command and check if the new link is registered as the push and pull URL.
git remote -v
Option two
If this method does not work, you may have to delete the git files and folders, then initialize the repo one more time and link it like you normally do,
First, you may have to remove the master origin branch.
to remove - git remote remove origin
or
git remote rm origin
then run
git remote set-url origin git://new.url.here
or
git remote set-url --push origin https://newurl
or
git remote set-url origin https://newurl
Run this command and check if the new link is registered as the push and pull URL.
git remote -v
Option three.
This option permanently deletes the git tracker in your local repository and lets you start like had not done this before.
Run these commands to completely remote the git files and folders.
rmdir .git
or
rm -rf .git
or
rm -rf .git
or
rm -rf .gitkeep
del /F /S /Q /A .git
or
rm -rf .git*
Once you have removed the git files from your local repo, run the following commands like you normally do on a newly created repo.
git init
then
git remote add origin REPO_URL
Any of these should work.
Run this command and check if the new link is registered as the push and pull URL.
git remote -v
Thank you.