2017-04-14 39 views
1

我有GitHub和BitBucket帳戶,但我只使用GitHub。就在幾天前,當我拿到BitBucket回購的客戶時,我決定嘗試一下,並安裝了SourceTree,並在那裏購買了回購,並且一切正常。當我參加我的GitHub回購項目時出現了問題。我所做的更改,並與控制檯做addcommit,當我寫這git push出來:GitHub在做git時更改爲BitBucket

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://[email protected]': 

其中xyz甚至不是我的到位桶

所以我的問題是這是怎麼發生的,我怎麼能恢復該用戶名或共享回購用戶的用戶名推動我的GitHub回購?

+0

你的回購庫中'git remote -v'的輸出是什麼? –

+0

'origin https://[email protected]/xyz/project_name.git(push)' – Norgul

+0

哦,可能是我從服務器上拉出了'.git',指向另一個存儲庫......我可以更改它對我的? – Norgul

回答

2

您提到在OP的評論git remote -v輸出:

$ git的遠程-v
起源https://[email protected]/xyz/project_name.git(推)

git remote -v鏈接到您的到位桶庫。您需要使用GitHub URL更改/設置origin

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

# make sure 'origin' is updated 
$ git remote -v 
相關問題