tags:

views:

129

answers:

4

What exactly are these commands doing:

ssh serveradmin%mt-example.com@[email protected]
cd domains/git.mt-example.com/html/mt-example.git
git --bare update-server-info
cd hooks
mv post-update.sample post-update
chmod a+x post-update

I'm not sure why the after the git --bar command they have update-server-info And what is going on in the 'hooks' folder?

Update

Taken from: http://kb.mediatemple.net/questions/1594/Using+Git

I am basically creating the Git repository while terminalling into the server. Do I still need to go into cd hooks, etc.?

A: 

git update-server-info has its own man page. Likewise, githooks have a man page. --bare is not a command, but a command modifer which doesn't seem to exist. It might be helpful if you told us where you got these instructions from.

innaM
updated, note I am terminalling into the server that will be the git bare, so do I need to do the hooks thing?
mrblah
A: 

The hooks directory contains hooks. Hooks are scripts that are run when specific events occur. For example, pushing to a repository, committing, et cetera.

Alan Haggai Alavi
+2  A: 

Setting up gitosis or something like it.

ssh serveradmin%mt-example.com@[email protected]

Log into mt-example.com as the user serveradmin%mt-example.com@serveradmin.

cd domains/git.mt-example.com/html/mt-example.git

put yourself into a git repository.

git --bare update-server-info

generate some files needed to run a dumb git server. --bare is a generic git option for declaring that you won't have a checkout in this clone.

cd hooks
mv post-update.sample post-update
chmod a+x post-update

Enable the post-update hook typically used in server configurations, by renaming it from the ineffective sample name to the name that git looks for, and making it executable.

bmargulies
`--bare` is documented in the Git manpage. Specifically, it says: "Treat the repository as a bare repository. If `GIT_DIR` environment is not set, it is set to the current working directory."
mipadi
+1  A: 

That sequence of commands installs a post-update hook. By default git puts a post-update.sample file in place, but sticks a .sample extension on it because not everybody's going to want to run it that way. You have to rename it to post-update before git will recognize it. The chmod line adds execute permissions to the post-update hook, which are required to run it. The default post-update hook simply runs git update-server-info on the repository. Since they also wanted you to manually run that command, my guess is that this entire sequence is intended to compensate for the means by which they assume you are committing to the repository; that's what git update-server-info does — it fixes up missing and outdated references and packs that should have been created/updated but weren't because an abnormal update mechanism was used.

In general, if someone suggests doing this, I would investigate and make sure it's really necessary; standard git installs and normal usage do not require this step.

Edit:

Yeah, it's necessary. They're having you pull commits over http and push them via ssh. Neither of those protocols are able to support the extra stuff that git needs done, so git update-server-info is required to resolve this.

Also... I can't say I recommend Grid Server. It's awfully expensive for what you actually get.

Bob Aman