从本地到本地推动

时间:2012-12-24 04:44:44

标签: git git-push

我正在尝试在本地计算机上添加第二个本地存储库。所以我创建了一个目录,在那里创建了一个git init,然后我跑了:git remote add new_repo /path/.git

然后从我的本地仓库中,我跑了git push -u mybranch,知道这是我推动的工作分支,然后我收到错误:

No refs in common and none specified; doing nothing.
Perhaps you should specify a branch such as 'master'.

我怎样才能成功地将我的东西推到第二个回购中?

3 个答案:

答案 0 :(得分:4)

你必须告诉它在哪里推送git push -u new_repo mybranchmybranch本地推送到mybranch上的new_repo(并设置跟踪,以便将来git push默认推送mybranchnew_repo)。

答案 1 :(得分:1)

Git只是不知道要推送什么 - 告诉它:

git push new_repo mybranch:mybranch

答案 2 :(得分:0)

从一个本地存储库推送到另一个本地存储库
从当前本地repo2的dev分支推送到本地repo1的master分支
注意: repo1的master分支不应处于检出状态,否则推送将失败,您可以在测试时添加新分支并检出

cd /path/to/repo2.git/
git push /path/to/repo1.git/ dev:master