Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/github/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何将Git回购从Beanstalk移动到Github?_Git_Github - Fatal编程技术网

如何将Git回购从Beanstalk移动到Github?

如何将Git回购从Beanstalk移动到Github?,git,github,Git,Github,我有我的代码回购。如何将代码从Beanstalk移动到?如果您已经在Beanstalk上使用Git,只需在GitHub上创建一个空存储库,然后将其作为远程存储添加到本地repo上即可 (假设您的回购协议在~/项目中) cd~/project git远程添加github git push github--all--tags 建议的方法是: git clone --bare url/for/beanstalk/repo.git . git push --mirror git@github.com:u

我有我的代码回购。如何将代码从Beanstalk移动到?

如果您已经在Beanstalk上使用Git,只需在GitHub上创建一个空存储库,然后将其作为远程存储添加到本地repo上即可

(假设您的回购协议在~/项目中)

cd~/project
git远程添加github
git push github--all--tags

建议的方法是:

git clone --bare url/for/beanstalk/repo.git .
git push --mirror git@github.com:user/repo.git
另请参见此处:

来自
#在本例中,我们使用名为extuser和extuser的外部帐户
#名为ghuser的GitHub帐户用于传输repo.git
#将外部回购复制到本地目录
$git克隆--裸https://githost.org/extuser/repo.git
#将镜像推送到新的GitHub repo
$cd repo.git
$git推送--镜像https://github.com/ghuser/repo.git
#取消临时本地回购
$cd。。
$rm-rf repo.git

这里给出的其他答案对我并不适用,但在Dan的难以置信的帮助下(甚至向我展示我根本不需要他的产品!),我完成了以下步骤,将我的9次回购从Beanstalk转移到githuhb,这是一件轻而易举的事。希望他们也能帮助别人

  • 开放式终端
  • 在用户目录中创建临时目录:
    mkdir~/moverepos
  • 打开此目录:
    cd moverepos
  • 克隆旧Beanstalk repo:
    git克隆--bare
  • 用repo打开目录:
    cd repositoryName.git
  • 打开Github,创建一个新的同名空repo并复制它的url
  • 将数据推送到新的目的地(在我们的例子中是GitHub):
    git Push--mirror
  • 如果这是您第一次执行此过程,则应提示您输入Beanstalk用户名和密码。现在输入它们 并观看回购协议推送到github
  • 如果您完成了,您可以在Finder中删除临时目录并在此处停止
  • 如果要移动更多回购,请导航到“移动回购”的根目录:
    cd..
  • 转到4

  • 你也可以
    push--all
    push--tags
    ,我按照建议做了,但是我没有得到分支神奇的答案,也可以用另一种方式工作(Github到Beanstalk)。这也会复制提交历史吗?(所有的分支机构呢?)
    git clone --bare url/for/beanstalk/repo.git .
    git push --mirror git@github.com:user/repo.git