【发布时间】:2023-03-07 11:59:01
【问题描述】:
在 git clone 之后,新仓库中的配置如下:
remote.origin.url=<some url>
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.master.remote=origin
branch.master.merge=refs/heads/master
然后,我可以执行“git pull”和“git push”。但我只对“git pull”感兴趣,因为我想推入另一个仓库。
我能做的一件事是:
git add remote repo-for-push <some other url>
git push repo-for-push master
但我想将 git 配置为使用默认和不同的存储库进行拉取和推送,即:
git pull # pulls from origin
git push # pushes into repo-for-push, avoiding accidental push into the origin
如何配置? 提前致谢。
编辑:
基本上,我想将默认推送存储库设置为与默认获取/拉取存储库不同。
【问题讨论】:
-
所以基本上你想设置默认的推送仓库与默认的获取/拉取仓库不同,对吧?也许你应该澄清一下。
-
对,还是一样的,但是字少了,:)
标签: git