【发布时间】:2019-09-18 13:16:59
【问题描述】:
假设我有一个本地存储库 A,并且我可以访问远程存储库 B。这些存储库完全不同!我想将所有文件/提交等从 A 推送到 B 存储库。 所以我做了以下 git 命令:
git remote add origin <my remote git url>git push origin master
我收到以下错误:
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.
问题的原因是我不想执行 git pull 命令,因为 B 存储库占用了大量空间(数千兆字节!)而 A 存储库需要几千字节。
有没有什么方法可以推而不拉?
【问题讨论】:
-
推送到远程不存在的分支。 (例如,在远程创建一个新分支)
-
AFAIK 你不能“将文件从 A 推送到 B”。提交是所有文件的快照,提交是“推送和拉取”的内容。 - 但是这个问题似乎不是在问那个
标签: git push git-remote