Re: Separate default push/pull?
On Thu, Feb 11, 2010 at 11:36 AM, David Abrahams <dave@boostpro.com> wrote:
Show 18 quoted lines
>
> If I am collaborating mostly with one other person, I typically want to
> pull from his publicly-readable repo and push to mine (on which I have
> write permission). Is there any way to set things up so “git pull” and
> “git push” without additional arguments will do this by default?
>
> Thanks,
>
> --
> Dave Abrahams Meet me at BoostCon: http://www.boostcon.com
> BoostPro Computing
> http://www.boostpro.com
>
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
Yes there is a way. I haven't used it myself but search this list and you'll find plenty of references.
(disclaimer: the following is what I think you can do based on some vague recollection and some man pages)
Taking a quick look at the git push --help you'll see the following snippet of configuration.
[remote "<name>"]
url = <url>
pushurl = <pushurl>
push = <refspec>
fetch = <refspec>so I think if you just add the pushurl to your .git/config should do what you've asked
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = git://git.kernel.org/pub/scm/git/git.git
pushurl = git://git.example.com/yourrepo.gitFor your own sanity I suggest doing this by adding your repository as a separate remote.
e.g.
git remote add yourrepo git://git.example.com/yourrepo.git
git push yourrepo master:refs/heads/master # the first time
git push yourrepo # subsequent times
There probably is a way to tell push to use something other than "origin" by default but I don't know/can't find it.