user9371654
user9371654

Reputation: 2408

How to fork a GitHub repository if I'm the owner

I have a private repository for a collaborative project. I created the repository so I'm the repo owner. I need to fork and make pull requests to the project collaborator. I tried to add myself as a collaborator but GitHub says I can not be added as a collaborator as I'm the project owner. Also the fork icon is disabled and I can not make a fork.

I own the repo but it is a shared project where I need to fork and do my changes, then make a pull request.

Although this is not a coding question but code-related question, I think programmers are the right people to help me.

Upvotes: 1

Views: 617

Answers (2)

tripleee
tripleee

Reputation: 189915

My use case is different. I want to experiment with Github Actions without polluting the main branch in my project.

The actions I want to test are specific to the main branch. It would be weird and unattractive to change the configuration to work on a separate branch. I really do want a fork of my repo which I can throw away when I'm done.

The simplest solution I could come up with was to manually create a new repo. So if I have the main branch of my project https://github.com/me/project checked out into project I can manually create project-fork on Github, then add that as a remote.

git add remote experiment https://github.com/me/project-fork
git push experiment master
... experimental edits
git push experiment master
... lather, rinse, repeat

Once I'm done I can rewind the main branch back to the point where I created the experiment (maybe create a tag for this?), or rebase to keep the parts of the experiment which make sense while discarding the rest, and resume normal operations.

Obviously, don't push to origin as long as the experiment is in progress. Perhaps even create a separate working directory for the fork and detach it from the main project if you want to be careful, and/or expect to be spending time on your experiment.

Upvotes: 0

Makkes
Makkes

Reputation: 1816

You can create a branch, push it and then create a PR from it. https://help.github.com/articles/creating-a-pull-request/

Upvotes: 1

Related Questions