M
M
Meliborn2012-08-18 15:14:01
git
Meliborn, 2012-08-18 15:14:01

How to raise a full-fledged git server?

What you need:
A shared git server that would apply changes immediately upon pull.

What is:
VPS hosting, git, ssh.

What's the problem:
There was a regular site in www/, I did git init, add ., commit for it. I made a clone on my local, everything was cloned. Now I need to push the changes from my repository back to production (vps). Pull refuses to do, citing that a bare repository is needed. But how can it be bare if it's production? As far as I know, these repositories themselves do not store files, but only changes to .git

Answer the question

In order to leave comments, you need to log in

9 answer(s)
M
Meliborn, 2012-08-18
@Meliborn

In general, I did this: bare repository + capistrano. It turned out very well.

K
kuzemchik, 2012-08-18
@kuzemchik

You can't push to a checked out branch. That's why bare is needed.
And in a good way, it would be necessary to export the code, and not force the web server to work from the repository. It is done with a simple hook on the server side.

V
Voenniy, 2012-08-18
@Voenniy

Pull refuses to do, referring to the need for a bare repository
Show what exactly it writes

I
Inori, 2012-08-18
@Inori

How was the clone made?
If everything is correct, then git push origin from local should be enough.

P
pomeo, 2012-08-18
@pomeo

git config --bool core.bare true? in the directory where you have www on vps

O
Oreolek, 2012-08-18
@Oreolek

If I understand correctly, then you need to upload the changes to the server and then apply them on the server. But then it turns out that you need 2 repositories on the server: the one where the push will be sent from the local computer and the one that will pull from the remote (because the server will not be able to pull from the local).
The second rep is easiest to do in the home folder, and pull is easiest to set up by cron, say, every day (or half a day).

M
Meliborn, 2012-08-18
@Meliborn

Did git config receive.denyCurrentBranch ignore on remote. Now push, but immediately marked as deleted judging by git status

M
middle, 2012-08-18
@middle

To "raise it on your own" - you can either just work via ssh, or use gitolite, where authentication takes place using ssh keys.

C
CKOPOBAPKuH, 2012-08-18
@CKOPOBAPKuH

I work through bare=false, denyCurrentBranch=ignore
besides this, only .git/hooks/post-receive:
#!/bin/sh
cd…
GIT_DIR='.git'
umask 002 && git reset --hard

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question