如何将现有的 git 项目(git-hub)推送到 bitbucket?

How to push existing git project (git-hub) to bit bucker?

我的本地系统中有 github 项目 openstack,我已经做了一些更改,现在我想将它推送到 https://bitbucket.org 存储库。我想将 kilo b运行ch 推送到我的远程存储库。

当尝试 运行

 git remote add origin https://username@bitbucket.org/user_name/my_project.git

我收到以下错误。

致命:远程源已经存在。我 运行 他们(位桶)提到的相同命令。 我不想删除 master,请告诉我如何将我的本地存储库添加到 bit-bucket..

[vagrant@localhost horizon]$ git branch
  master
  stable/icehouse
  stable/juno
* stable/kilo


[vagrant@localhost horizon]$ git branch -a
  master
  stable/icehouse
  stable/juno
* stable/kilo

您有一个名为 origin 的现有遥控器,您可以使用

进行检查
git remote -v

您可以 delete/rename 现有的遥控器,也可以创建一个新的遥控器。

git remote add mynewremote https://username@bitbucket.org/neelabh_singh/my_project.git

如果你想将其命名为 origin 那么只需 rename/remove 现有的原点,

git remote rename origin <new_name_for_old_origin>

git remote remove origin

使用不同的遥控器

git remote add bitbucket https://username@bitbucket.org/neelabh_singh/my_project.git
git push bitbucket  stable/kilo:kilo

以下是从 github 迁移到 bitbucket

的步骤

1.First 使用命令

将存储库克隆到本地计算机
git clone <repository url>

2.After 克隆成功分离您的 git 集线器存储库

git remote -v
git remote rm origin

3.After 分离您的 github 存储库。转到您的 bitbucket 并创建一个存储库并找到选项 I have code that I want to import 并单击它。

4.It 会给你命令,你需要从你的项目目录控制台 运行。命令如下所示

git remote add origin ssh://git@bitbucket.org/urRepository/urproject.git #you would get your repo link from bitbucket.
git push -u origin master # to push changes for the first time

它会完成的。