Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to import old Stash export into Bitbucket

moby_dev May 25, 2020

I have an old Stash export that contains a repository along with all of its history.  For some reason I can't get this one repository to import into Bitbucket.  I did successfully do this for 25 other old repos, but this one is simply not cooperating.  I wrote down notes on how I did it for the other 24, but it doesn't work for this one repo.

Can I get the exact steps and commands on how to do this correctly?

Thanks!! Steve Miller

1 answer

0 votes
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 25, 2020

If you've got 24 done, you already have the "exact steps and commands", and they work.

The question should be "what is different about this one?".  Also, what are the warnings and errors you are seeing?

moby_dev May 25, 2020

Well, not so fast!  I did the other repos about 6 months ago and thought my notes were what I used.  I'm not so sure now.

 

This is what I did:

# Make a bare mirrored clone of the repository
git remote set-url --push origin https://bitbucket.company.com/scm/company/repo.git

# Create the repository in Bitbucket

# Set the push location to your mirror
git push --mirror

When I run these two commands I get this:

Enumerating objects: 861, done.
Counting objects: 100% (861/861), done.
Delta compression using up to 8 threads.
Compressing objects: 100% (240/240), done.
Writing objects: 100% (861/861), 170.18 KiB | 4.15 MiB/s, done.
Total 861 (delta 619), reused 861 (delta 619)
remote: Resolving deltas: 100% (619/619), done.
remote: You are attempting to update refs that are reserved for Bitbucket's pull request functionality. Bitbucket manages these refs automatically, and they may not be updated by users.
remote: Rejected refs:
remote: refs/pull-requests/1/from
remote: refs/pull-requests/1/merge
remote:
To https://bitbucket.company.com/scm/company/repo.git
! [remote rejected] develop -> develop (pre-receive hook declined)
! [remote rejected] feature/companyPROD-1286 -> feature/companyPROD-1286 (pre-receive hook declined)
! [remote rejected] feature/companyPROD-1405 -> feature/companyPROD-1405 (pre-receive hook declined)
! [remote rejected] feature/companyPROD-219 -> feature/companyPROD-219 (pre-receive hook declined)
! [remote rejected] feature/redis -> feature/redis (pre-receive hook declined)
! [remote rejected] feature/upgraderequired -> feature/upgraderequired (pre-receive hook declined)
! [remote rejected] master -> master (pre-receive hook declined)
! [remote rejected] viral-glue -> viral-glue (pre-receive hook declined)
! [remote rejected] refs/pull-requests/1/from -> refs/pull-requests/1/from (pre-receive hook declined)
! [remote rejected] refs/pull-requests/1/merge -> refs/pull-requests/1/merge (pre-receive hook declined)
! [remote rejected] stable-20120130 -> stable-20120130 (pre-receive hook declined)
error: failed to push some refs to 'https://bitbucket.company.com/scm/company/repo.git'

moby_dev May 25, 2020

Note to add:

I do get something in the import...  One tag with some old files...  Not helpful!

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 27, 2020

Ahh, you have an export that's slightly broken.   Start from Ana's fix over at https://community.atlassian.com/t5/Bitbucket-questions/Bitbucket-reserved-refs-when-cleaning-up-with-BFG-tool/qaq-p/702969

moby_dev May 27, 2020

I was able to fix it with help from this web post:

https://stackoverflow.com/questions/44106103/how-to-import-gitlab-repository-to-bitbucket-repository

#cd to the .git folder
cd /d/Development/Repositories/repo.git

# Make a bare mirrored clone of the repository
git remote add repo https://bitbucket.company.com/scm/repos/repo.git

# Create the repository in Bitbucket

# Set the push location to your mirror
git push --all repo
git push --tags repo

All is good now!!!

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
TAGS
AUG Leaders

Atlassian Community Events