How to import gitlab repository to bitbucket Repository

余生长醉 提交于 2020-07-04 06:27:26

问题


I have a gitlab Repository and I want it to update it on the bitbucket account.

Please provide me steps to follow, so that it can be helpful to me to migrate it in bitbucket from Gitlab.


回答1:


Follow these steps:

  1. Create a new repo in bitbucket.
  2. git clone <gitlabRepoUrl>
  3. cd <repoName>
  4. git remote add bitbucket <bitbucketRepoUrl>
  5. git push bitbucket master



回答2:


1) Create the repository in Bitbucket using the UI

2) Clone the Gitlab repository using the "--bare" option

git clone --bare GITLAB-URL

3) Add the Bitbucket remote

cd REPO-NAME
git remote add bitbucket BITBUCKET-URL

4) Push all commits, branches and tags to Bitbucket

git push --all bitbucket
git push --tags bitbucket

5) Remove the temp repository

cd ..
rm -rf REPO-NAME



回答3:


If you want to do it straight from the repositories themselves there is a way also.

  1. Rsync the /home/git/repositories directory (copying them is less risky than working on source files themselves) to your home dir

    sudo rsync -avzh /home/git/repositories /home/<YOURUSER>/repos/

  2. Set the permissions on your repos dir to yourself

    sudo chown -R <YOURUSER>:<YOURUSER> /home/<YOURUSER>/repos

  3. Create the empty repo on bitbucket.

  4. Mirror them locally to create a working copy that contains all branches and tags with you.

    git clone --mirror git@gitlab.mydomain.com/source-repo.git

  5. Then you would want to simply push the mirror.

    cd source-repo.git git push --mirror git@bitbucket.com/new-location.git



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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!