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

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to import old Stash export into Bitbucket

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

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?

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'

Note to add:

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

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
Community showcase
Published in Bitbucket

Powering DevOps with Bitbucket Server & Data Center

Hi everyone, The Cloud team recently announced 12 new DevOps features that help developers ship better code, faster   ! While we’re all excited about the new improvements to Bitbucket ...

1,849 views 0 7
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