Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

How to import an external (public) repository, to our local git server to be used in local projects.

In Mercurial/Hg it is possible to make a copy of an external repository to your local server, and use this (local) repository as a subrepo in your project.
Using this method your project does not rely on external repositories, which can be down/moved/deleted/... , just on your local server.

I know the local copy must be updated manually, for Mercurial this was done using the server setting pages (as far as I can remember).

Is this also possible for Git?

1 answer

1 accepted

0 votes
Answer accepted

Bitbucket allows you to fork an external repository into your workspace. This effectively is your own copy of the original. If the original repository gets deleted, your fork will still remain since it is decoupled once the fork is complete.

Git supports submodules. A submodule keeps track of an external repository and when you clone the top level repository with `--recurse-submodules` option, it will pull in changes from repositories pointed by the submodules in the top repository. However, this is done on your client and not on Bitbucket Cloud hosting side.

If you want to maintain copies of external dependencies to avoid surprises when they get deleted, forking them is your best option. However, you will have to keep updating your forks from the original to keep them in sync.

I already understand the submodules principle.

But I think the result is:
Fork to a repository and have this repository stored on your bitbucket server.
Now use this forked repository as submodules in one or (git) projects.

I do not know whether possible, but this is also not my desire to achieve: When able to use a submodule as a fork, this would imply my project clone would contain the (full) forked submodule...

So fork to a (new) repository and use this repository as a submodule in your project.

Some googled usefull, and maybe not fully related links:

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Bitbucket

Git push size limits are coming to Bitbucket Cloud starting April 4th, 2022

Beginning on April 4th, we will be implementing push limits. This means that your push cannot be completed if it is over 3.5 GB. If you do attempt to complete a push that is over 3.5 GB, it will fail...

2,239 views 2 9
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you