Re: Update a bare repository
From: Jeff King <hidden>
Date: 2016-06-15 22:43:21
On Tue, Jul 17, 2007 at 08:30:26AM +0200, Thomas Glanzmann wrote:
I have a _bare_ clone of a git repository and would like to update it from Junios repository at kernel.org from time to time. [...] "git pull" does not work. "git fetch" does, but it does update all references?
You don't want to pull because that involves merging, which doesn't make sense. A git-fetch is what you want, and you can use wildcards to make sure you get all of the refs. The default is something like this: [remote "origin"] url = git://git2.kernel.org/pub/scm/git/git.git fetch = +refs/heads/*:refs/remotes/origin/* However, if you are intending to make this an _exact_ copy of Junio's (because you will be fetching from it with your other, non-bare repos), then you probably don't want the "separate remotes" layout. You want to copy the refs with the same names: [remote "origin"] url = git://git2.kernel.org/pub/scm/git/git.git fetch = +refs/heads/*:refs/heads/* The "+" in both cases means that it copies whatever Junio has, even if it might lose some commits of yours. But that seems to be what you want in this case.
I also would like to check that it is impossible to push anything to the repository.
The simplest thing is not to give write access to the repo for your pushers. However, you could also put in a pre-receive hook that rejects all pushes. -Peff