“git push all” (多个存储库)不起作用 [英] "git push all" (multiple repositories) doesn't work
问题描述
此答案解释了如何同时推送到多个回购。
-
我的
.git / config
包含:
[remoteall]
url = git@github.com:commerce-sciences / scale-master.git
url = git@heroku.ron:scale-master。 git
-
git all all
部署到heroku。
-
似乎由于某些原因,更改不会推送到github。
>
> git push all
所有最新的
所有最新的
> git status
#在分支主机上
#你的分支在22次提交之前超过'origin / master'。
$
无需提交(工作目录清理)
我缺少什么?
您配置全部
远程存储库,它根本没有链接到本地存储库中的现有存储库。因此,尽管它具有相同的URL,但 all
中的第二个存储库与 origin
不同。
当你推送给所有人时,Git并不知道它也会在执行时推到 origin
。因此,它无法更新本地存储库中的远程分支。
不幸的是,您无法更改此行为。 git push
不支持远程资源库组为 git fetch
。至少尚未。如果是这样,Git会有一个从远程仓库(组) all
到 origin
的显式链接,并且可以更新本地引用。
因此,现在您唯一的选择就是在推送到 all
,使用 git fetch origin
或者只是 git fetch
(用于远程跟踪分支),或者直接推送给它们开始。
This answer explains how to push to multiple repos simultaneously.
My
.git/config
contains:[remote "all"] url = git@github.com:commerce-sciences/scale-master.git url = git@heroku.ron:scale-master.git
git push all
successfully deploys to heroku.It seems that changes are not pushed to github for some reason.
> git push all Everything up-to-date Everything up-to-date > git status # On branch master # Your branch is ahead of 'origin/master' by 22 commits. # nothing to commit (working directory clean)
What am I missing?
The way you have configured your all
remote repository, it’s not linked to the existing repositories in your local repository at all. So the second repository in all
is not the same as origin
although it has the same URL.
When you push to all, Git does not know that it also pushes to origin
while doing that. As such it can’t update the remote branches that are in your local repository.
Unfortunately, you cannot change this behaviour. git push
does not support remote repository groups as git fetch
does. At least not yet. If it did, Git would have an explicit link from the remote repository (group) all
to origin
and could update the local references.
So for now, the only option you have is to fetch the individual remotes right after pushing to all
, using git fetch origin
or just git fetch
(for remote-tracking branches), or push to them explicitely to begin with.
这篇关于“git push all” (多个存储库)不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!