We are moving our repositories from Bitbucket to our local environment in Stash. I am able to import latest version of repositories but not details of previous commits and versions. I am describing steps I am doing to bring repositories into Stash. Can you please guide me what I should do to bring repositories with all branches, commits and version details, so we can stop using Bitbucket after having Stash. Thanks. Steps:
Sorry guys, new to Git, my command and way may be dirtiest :) Appreciate your help and time. Thanks |
Hi Tamoj,
So you don't want to be running 'git init' - that's not going to do anything. (And you don't need to create a commit either).
Secondly - can I assume you're only seeing the 'master' branch in Stash? Does that contain all your commits (plus 'Initial commit') or does it just have "Intial commit"?
In any case if you want to get an exact copy of the bitbucket repository I would do something like:
> git clone --mirror http://bitbucket.org/user/repo.git
> cd repo
> git remote set-url origin http://User@localhost:7990/scm/PROJECT/repo.git
> git push
That should get you an exact mirror of the repository. Be a _little_ careful with mirror - when you push to a remote it will ensure everything is idential - which if you push to a repository that has new changes you're going to lose them (well sort of - you can always get things back in Git).
Alternatively you could use this plugin (Warning - I've not tried it)
https://marketplace.atlassian.com/plugins/com.englishtown.stash-hook-mirror
How many repositories are you migrating by the way?
Good luck,
Charles
Thanks Charles, I appriciate your help and time, I acted as per suggest and need cleaerity a little more please.
Running Git Bash I was in default direcotry path was ~ <master> I run the following command there and it was ok and after asking password it cloned successfully.
> git clone --mirror http://bitbucket.org/user/repo.git
> cd repo What repo it should be ? A new folder and make it a repository by running git init or give path of my Stash repository ?
I could not run 3rd command (> git remote set-url origin http://User@localhost:7990/scm/PROJECT/repo.git) successfully. I have attempted 2 things here.
Can you please guide further.
Really appriciate you help.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Tamoj,
When you run the git clone on your repository it should have created a directory called 'repo' (actually now that I think about it - it was probably 'repo.git'). What do you see in the folder where you cloned?
You definitely don't need to run 'git init'.
Cheers,
Charles
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.