I have a local git repo. I want to fork it and use it as the basis of a new project. The new project should never be able to push anything back to the original project. Here is what I think I should do...
git clone originalproject newproject
git remote remove origin
Is there anything else I ought to do to break the link between the two repos and create an independent local fork?
edit: This will work fine locally but if you'd rather link to a new remote repo then see codeWarrior's answer below.
In the top-right corner of the page, click Fork . To learn more about GitHub CLI, see " About GitHub CLI ." To create a fork of a repository, use the gh repo fork subcommand. To create the fork in an organization, use the --org flag.
How does Forking (Git Fork) work? Git Fork is a simple process in GitHub and it does not require to use any git command. The process of Git Fork follows the below steps: Fork a Repository: User creates a copy of the repository to their own GitHub account, the steps for the same are covered in the next section.
Fork the repository Using the appropriate repository, create a fork of the repository into your own GitHub account by using the GitHub website. A personal fork is required since all main documentation repositories provide read-only access. To make changes, you must submit a pull requestfrom your fork into the main repository.
Choose a folder name should be easy for you to remember and type. For example, consider a root folder C:\docs\or make a folder in your user profile directory ~/Documents/docs/ Important Avoid choosing a local folder path that is nested inside of another git repository folder location.
Yep, it will work but instead of removing the origin update it to the new link
# Clone the existing project to a new location
git clone originalproject newproject
# Update the remote to the new git repository URL
git remote set-url <remote> <url>
If you have git hooks on your original repository they will not be copied to the new one so you will need to copy them as well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With