将现有的远程仓库重新分配给我的本地仓库

时间:2015-05-11 12:52:14

标签: git bitbucket

所以我在这里找不到关于Git / Bitbucket的东西,但我不确定到底是什么。也许有点超出我的深度。

我有一个已经休眠了一年的项目,并且它已经失去了与Bitbucket的联系。如何将现有远程原点重新分配给我的本地仓库?

我做了一个本地git提交(工作正常),但是当我在推送之前git pull时,我得到了这个:

There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details

    git pull <remote> <branch>

If you wish to set tracking information for this branch you can do so with:

    git branch --set-upstream-to=origin/<branch> master

我试过了:

git branch --set-upstream-to=origin/git@bitbucket.org:<username>/<repo>.git master

......没有用。我明白了:

error: the requested upstream branch 'origin/git@bitbucket.org:<username>/<repo>.git' does not exist
hint: 
hint: If you are planning on basing your work on an upstream
hint: branch that already exists at the remote, you may need to
hint: run "git fetch" to retrieve it.
hint: 
hint: If you are planning to push out a new local branch that
hint: will track its remote counterpart, you may want to use
hint: "git push -u" to set the upstream config as you push.

我知道我有一个BitBucket repo用于这个项目(在我的浏览器中访问BitBucket确认了这一点),项目状态只有一个提交。

提前致谢。

1 个答案:

答案 0 :(得分:1)

而不是

git branch --set-upstream-to=origin/git@bitbucket.org:<username>/<repo>.git master

尝试使用

git branch --set-upstream-to=origin/master master

然后,运行git fetch