tags:

views:

35

answers:

2

I'm a noob when it comes to git.

How would I get it so I can do something like git push production master and have the remote repository mirror my own?

Currently, whenever I run git push production master I get:

error: By default, updating the current branch in a non-bare repository

...

! [remote rejected] master -> master (branch is currently checked out)

What am I doing wrong?

+2  A: 

Pushing to working repositories is a bit dangerous as any work in progress is not taken into account by the push, and it is quite easy to subsequently lose any uncommitted changes (basically the working HEAD can get out of step with the working branch HEAD). The full, gory details are in the following link:

git push to a non-bare repository

It is recommended that your published repository should be a bare repo which does not have a checked out tree. Bare repos are created using the "git clone --bare" option.

Dipstick
So if I were to run `git init --bare` on my server in a given directory and I pushed to that repository, where would I find the actual files? All I see is `branches` and `config` and things like that. Thanks
Tyler
You don't find the actual source files in the bare public repository on the server - you do a clone of it to get a working repository which has the files of a particular branch (typically master) checked out - but I guess from the answer you gave to your own question that you already figured that out.
Dipstick
@chris actually that cleared up what I was actually doing.thanks!
Tyler
A: 

Aparently what I was looking for is an unconventional way to use git.

I followed http://danielmiessler.com/blog/using-git-to-maintain-your-website and got what I was looking for.

Tyler