How to fork your own repo on BitBucket?
Asked Answered
O

3

8

How to fork your own repo on BitBucket ?

I know how to fork another user repo from web interface, and I know how to clone my repo.

But how to fork your own repo on BitBucket and ease a future pull request workflow?

Orson answered 15/6, 2017 at 20:44 Comment(0)
P
7

Go to your repository, and then go to Actions -> Fork.

If you have the new navigation enabled, then go to your repository, click on the + on the left navigation bar and then Get to work -> Fork this repository.

Also, make sure that forking is enabled in repository settings (for the existing repository).

Plicate answered 15/6, 2017 at 20:52 Comment(4)
This is an import, exactly as cloning, This do not create a fork, because doesn't create a master-fork link in repo propertiesOrson
@Orson you can fork your own repo just like someone else's repo. Go to your repo and click Actions->Fork.Plicate
Oh yes. I see I disabled forking in repo settings. Swith it ON, and now forking is enble! Thank you!Orson
Could @Gaby aka G. Petrioli update the answer with "check is forking is enabled in repo settings"Orson
R
5

First, create a new repository 'bar'. Next, clone the existing project 'foo':

$ git clone [email protected]:YOURNAME/foo.git bar

Next, edit your Git config file and replace the origin URL with your new URL:

$ cd bar
$ vim .git/config
    [remote "origin"]
    fetch = +refs/heads/*:refs/remotes/origin/*
    url = [email protected]:YOURNAME/bar.git #replace foo with bar

Optionally add your original repo as an upstream source:

$ git remote add upstream [email protected]:YOURNAME/foo.git

Finally, push your new repository up to Bitbucket:

$ git push -u origin master

Now you can push/pull from your new repo (bar) as expected. You should also be able to merge upstream changes using the following command:

$ git fetch upstream
$ git merge upstream/master

credit: bitdrift

Rappee answered 15/6, 2017 at 21:30 Comment(0)
G
0

On bitbucket server, it does not seem to be an option to fork from your own personal repository. I ran into this trying to move a personal repository to a public location. Possible options:

Get someone else to fork it for you or use a different login if available.

Or

From the project settings, "Move" the repository to the public location, then fork the moved repository back to the original location.

Grajeda answered 14/6, 2022 at 15:31 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.