Private forks inherit the permissions structure of the upstream or parent repository.
For example, if the upstream repository is private and gives read/write access to a team, then the same team will have read/write access to any forks of the private upstream repository.
This helps owners of private repositories maintain control over their code.
# list all remote repo for the fork
git remote -v
# specify a remote upstream repo that will be synced with the fork
git remote add upstream <RemoteRepoURL>
# check if added successfully
git remote -v
For greater collaboration, you can allow commits on branches you've created from forks. Permission to commit to your forked branches is limited to those with push access to the upstream repository of the fork.
Only pull request creators can give upstream repository maintainers, or those with push access to the upstream repository, permission to make commits to their pull request's compare branch.
Pull request creators can give these permissions on each of their pull requests when they initially create a pull request from a fork or after they have created the pull request.
If you remove a person’s access to a private repository, any of their forks of that private repository are deleted. Local clones of the private repository are retained.
If a team's access to a private repository is revoked or a team with access to a private repository is deleted, and team members do not have access to the repository through another team, private forks of the repository will be deleted.
Deleting a private repository
When you delete a private repository, all of its private forks are also deleted.
Deleting a public repository
When you delete a public repository, one of the existing public forks is chosen to be the new parent repository. All other repositories are forked off of this new parent and subsequent pull requests go to this new parent.
Private forks and permissions
Private forks inherit the permissions structure of the upstream or parent repository. For example, if the upstream repository is private and gives read/write access to a team, then the same team will have read/write access to any forks of the private upstream repository. This helps owners of private repositories maintain control over their code.
Changing a public repository to a private repository
If a public repository is made private, its public forks are split off into a new network. As with deleting a public repository, one of the existing public forks is chosen to be the new parent repository and all other repositories are forked off of this new parent. Subsequent pull requests go to this new parent.
In other words, a public repository's forks will remain public in their own separate repository network even after the parent repository is made private. This allows the fork owners to continue to work and collaborate without interruption. If public forks were not moved into a separate network in this way, the owners of those forks would need to get the appropriate access permissions to pull changes from and submit pull requests to the (now private) parent repository—even though they didn't need those permissions before.
Deleting the private repository
If a public repository is made private and then deleted, its public forks will continue to exist in a separate network.
Changing a private repository to a public repository
If a private repository is made public, each of its private forks is turned into a standalone private repository and becomes the parent of its own new repository network. Private forks are never automatically made public because they could contain sensitive commits that shouldn't be exposed publicly.
If you own a private fork that has been converted into a standalone private repository and you have the free plan, the repository will be locked. To access the repository again, you can upgrade to a paid plan or make the repository public.
Deleting the public repository
If a private repository is made public and then deleted, its private forks will continue to exist as standalone private repositories in separate networks.
About forks
Configuring a remote for a fork
Syncing a fork
Merging an upstream repository into your fork
Allowing changes to a pull request branch created from a fork
What happens to forks when a repository is deleted or changes visibility?
Deleting a private repository
When you delete a private repository, all of its private forks are also deleted.
Deleting a public repository
When you delete a public repository, one of the existing public forks is chosen to be the new parent repository. All other repositories are forked off of this new parent and subsequent pull requests go to this new parent.
Private forks and permissions
Private forks inherit the permissions structure of the upstream or parent repository. For example, if the upstream repository is private and gives read/write access to a team, then the same team will have read/write access to any forks of the private upstream repository. This helps owners of private repositories maintain control over their code.
Changing a public repository to a private repository
If a public repository is made private, its public forks are split off into a new network. As with deleting a public repository, one of the existing public forks is chosen to be the new parent repository and all other repositories are forked off of this new parent. Subsequent pull requests go to this new parent.
In other words, a public repository's forks will remain public in their own separate repository network even after the parent repository is made private. This allows the fork owners to continue to work and collaborate without interruption. If public forks were not moved into a separate network in this way, the owners of those forks would need to get the appropriate access permissions to pull changes from and submit pull requests to the (now private) parent repository—even though they didn't need those permissions before.
Deleting the private repository
If a public repository is made private and then deleted, its public forks will continue to exist in a separate network.
Changing a private repository to a public repository
If a private repository is made public, each of its private forks is turned into a standalone private repository and becomes the parent of its own new repository network. Private forks are never automatically made public because they could contain sensitive commits that shouldn't be exposed publicly.
If you own a private fork that has been converted into a standalone private repository and you have the free plan, the repository will be locked. To access the repository again, you can upgrade to a paid plan or make the repository public.
Deleting the public repository
If a private repository is made public and then deleted, its private forks will continue to exist as standalone private repositories in separate networks.