我有GitHub和BitBucket帐户,但我只使用GitHub帐户。就在几天前,当我使用BitBucket回购客户端时,我已经决定试用它并安装了SourceTree,在那里拉回了一个回购,一切正常。当我继续我的GitHub仓库上的项目时,问题就出现了。我做了更改,并且控制台执行了add
和commit
,当我写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回购呢?
答案 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