2016-12-14 58 views
1

我在Heroku上有一個節點服務器,它的終端擴展名爲git。我如何分別使用這兩個存儲庫?我在github上有一個回購,我想用於另一個項目,但我無法切換推送目的地,這一切都歸Heroku主人所有。Github和Heroku終端混淆(osX)

如何更改分支?我已經嘗試了幾種設置git origin分支的方法,並試圖直接推送它,但它仍然顯示一個heroku主。

screenshots removed for privacy, see resolution details in comments

回答

1

您可以用change the remote tracking branch of your current branch

git branch branch_name -u your_new_remote/branch_name 

你的情況:

git branch master -u origin/master 

這將使git statusgit push考慮遠程origin,而不是heroku

其他的解決方案是可行的:

git config branch.master.remote origin 

此假設起源確實存在。
如果它不(見git remote -v輸出),您可以聲明與新的目標:

git remote add origin /new/destination/url 

如果你想完全取代現有的原點設置(推和拉):

git remote set-url origin /new/destination/url 

如果你只是想推網址

git remote set-url --push origin /new/destination/url 

請參閱 「Change the remote URL to your repository」。

+0

感謝您的回覆!請參閱原始文章中的新屏幕截圖。 – Micard

+0

@Micard我已經編輯了我的答案,供您聲明遠程原點。 – VonC

+0

請看另一張截圖:) – Micard