Avoding accidental deployment of 2 bitbucket repositories into to single GitHub repository

I have 2 BitBucket projects , Project1 and Project2 , Project1 has a repository named “repo1” and Project2 also has a repository named “repo1”. Say I have deployed repo1 from Project1 on to GitHub and the Github repository name is “repo1”. Next if I try to deploy “repo1” from Project2, contents of “repo1” from “Project2” will be merged into the the GitHub repo “repo1”.GitHub repo “repo1” will have the contents of “repo1” of Project1 and “repo1” of Project2 , which will lead to undesirable results. Is there any way we can avoid this?

@harikumar13,

On GitHub, it is not allowed that multiple repositories with the same name are in the same organization account or user account. Each repository has an unique name in an account.

If you want to merge “repo1” of Project1 and “repo1” of Project2 to different repositories with the same name “repo1” on GitHub, you can create two organizations on GitHub and create a repository named “repo1” in each organization. Then merge the repositories from BitBucket to the two different organizations on GitHub.

1 Like

Thanks for the reply. Yes we usually don’t do it. But what if we use a CI system and it accidentally deploys the contents of 2 repositories into a single GitHub repository? Is there any settings or method available on Github to avoid this?

@harikumar13,

I do not find such settings or methods on GitHub.

When you use the CI pipeline on BitBucket to merge source code from a BitBucket repository to a GitHub repository, normally you need to specify the URL of the GitHub repository so that the CI system can accurately link to the right GitHub repository.

So, I recommend you to check if you have specified the URLs to a same GitHub repository in the CI pipelines you setup in “repo1” of Project1 and “repo1” of Project2. If so, change them to be different.

1 Like