我从github克隆了一个公共存储库,做了一些修改,现在我想把它们推到一个私人回购系统上。我所采取的步骤如下:
$ git clone -b dev https://github.com/public_repo
$ cd public_repo
## modify files
$ git add .
$ git status
On branch dev
Your branch is up to date with 'origin/dev'.
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
new file: ...
modified: ...
modified: ...
...
$ git commit -m "Now supports new features"
[dev 5f98577c] Now supports Chiplet
68 files changed, 2855 insertions(+), 1910 deletions(-)
create mode 100644 ....
$ git remote add private https://private_domain
$ git push private dev
Username for ...
Password for ...
To https://private_domain
! [rejected] dev -> dev (fetch first)
error: failed to push some refs to 'https://private_domain'
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.请注意,私有存储库也位于dev分支上。我怎么才能解决呢?
发布于 2022-06-30 09:16:38
根据错误:您在私有回购dev分支上有不同的代码,并且您试图在不需要拉的情况下推动其他一些更改。请试着在推前拉一下。
https://stackoverflow.com/questions/72813051
复制相似问题