heroku-like git setup?
Asked Answered
D

2

0

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?

Dulsea answered 10/7, 2010 at 5:26 Comment(0)
A
4

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.

Attaboy answered 10/7, 2010 at 5:46 Comment(3)
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. ThanksDulsea
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.Attaboy
@chris actually that cleared up what I was actually doing. thanks!Dulsea
D
1

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.

Dulsea answered 10/7, 2010 at 6:57 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.