Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

[Bitbucket] Import many projects at once

Marcelo L. Filho June 11, 2018

Hi,

I would like to migrate from our local Gitlab to the internal Bitbucket.

There is the "import" feature and is very helpful but I would like to do it on many projects. Is there a way to do it even by CLI or REST?

Thanks.

1 answer

0 votes
Craig Castle-Mead
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 11, 2018

For the heavy git migrations we've done, we wrote scripts that given a projectname and reponame (comma delimited file) will loop through, do a full clone, then push to the new git provider. You'll need to set/variablize the user/oldgit/newgit appropriately.

Depending on the number of projects needed, we've also added a check using the API to confirm if the target project exists, and if not, create and set permissions. If there's only a handful of target projects, we manually create.

** I haven't tested the below **

 

while read r; do
  project = `r | cut -d ',' -f 1`
  repo = `r | cut -d ',' -f 2`
  git clone --verbose --bare https://olduser@oldgit/scm/$project/$repo.git
  git push --mirror https://newuser@newgit/scm/$project/$repo.git
done < input.txt

 

CCM

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events