git 如何将 gitlab 存储库导入到 bitbucket 存储库

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/44106103/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 12:46:22  来源:igfitidea点击:

How to import gitlab repository to bitbucket Repository

gitbitbucketgitlab

提问by Anubhav

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

我有一个 gitlab 存储库,我希望它在 bitbucket 帐户上更新它。

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

请提供我要遵循的步骤,以便我将它从 Gitlab 迁移到 bitbucket 中。

回答by Marcelo ávila de Oliveira

1) Create the repository in Bitbucket using the UI

1) 使用 UI 在 Bitbucket 中创建存储库

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

2)使用“--bare”选项克隆Gitlab存储库

git clone --bare GITLAB-URL

3) Add the Bitbucket remote

3)添加Bitbucket遥控器

cd REPO-NAME
git remote add bitbucket BITBUCKET-URL

4) Push all commits, branches and tags to Bitbucket

4) 将所有提交、分支和标签推送到 Bitbucket

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

5) Remove the temp repository

5)删除临时存储库

cd ..
rm -rf REPO-NAME

回答by Bishakh Ghosh

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
  1. 在 bitbucket 中创建一个新的 repo。
  2. git clone <gitlabRepoUrl>
  3. cd <repoName>
  4. git remote add bitbucket <bitbucketRepoUrl>
  5. git push bitbucket master

回答by blamb

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 [email protected]/source-repo.git

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

    cd source-repo.gitgit push --mirror [email protected]/new-location.git

  1. 将 /home/git/repositories 目录(复制它们比处理源文件本身风险更小)同步到您的主目录

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

  2. 将您的 repos 目录的权限设置为您自己

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

  3. 在 bitbucket 上创建空仓库。

  4. 在本地镜像它们以创建一个包含所有分支和标签的工作副本。

    git clone --mirror [email protected]/source-repo.git

  5. 然后你会想要简单地推动镜子。

    cd source-repo.gitgit push --mirror [email protected]/new-location.git