早期我只有github存储库,但现在想要使用github和bitbucket。 我在Bitbucket上添加了一个新的远程git存储库,使用 git remote set-url 。
git remote -v show
origin https://github.com/My/remont (fetch)
origin https://github.com/My/remont (push)
origin https://my@bitbucket.org/my/remont.git (push)
然后运行:
git add --all .
git commit -m "bitbucker"
git push -u origin master
Github添加正常但bitbucket显示错误
Password for 'https://my@bitbucket.org':
To https://bitbucket.org/my/remont.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'https://my@bitbucket.org/my/remont.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.