在执行git push

时间:2017-04-14 12:20:30

标签: git github bitbucket

我有GitHub和BitBucket帐户,但我只使用GitHub帐户。就在几天前,当我使用BitBucket回购客户端时,我已经决定试用它并安装了SourceTree,在那里拉回了一个回购,一切正常。当我继续我的GitHub仓库上的项目时,问题就出现了。我做了更改,并且控制台执行了addcommit,当我写git push时,这就出现了:

warning: push.default is unset; its implicit value has changed in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the traditional behavior, use:

  git config --global push.default matching

To squelch this message and adopt the new behavior now, use:

  git config --global push.default simple

When push.default is set to 'matching', git will push local branches
to the remote branches that already exist with the same name.

Since Git 2.0, Git defaults to the more conservative 'simple'
behavior, which only pushes the current branch to the corresponding
remote branch that 'git pull' uses to update the current branch.

See 'git help config' and search for 'push.default' for further information.
(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
'current' instead of 'simple' if you sometimes use older versions of Git)

fatal: The current branch master has no upstream branch.
To push the current branch and set the remote as upstream, use

    git push --set-upstream origin master

所以我想我运行git config --global push.default matching命令再试一次。之后我收到一条消息说:

Password for 'https://xyz@bitbucket.org':

其中xyz甚至不是BitBucket上共享回购用户的用户名或用户名

所以我的问题是这是怎么发生的,我怎样才能恢复这个以推动我的GitHub回购呢?

1 个答案:

答案 0 :(得分:2)

您在OP的评论中提到了git remote -v输出:

  

$ git remote -v
  来源https://xyz@bitbucket.org/xyz/project_name.git(推)

git remote -v链接到您的BitBucket存储库。您需要使用GitHub URL更改/设置origin

$ git remote set-url origin <github-repo-url>

# make sure 'origin' is updated
$ git remote -v