That was r e a l ly helpful. Will giv it a try. Thanks a lot.

On Tuesday, November 19, 2013 5:39:10 PM UTC+1, Konstantin Khomoutov wrote:
>
> On Tue, 19 Nov 2013 04:30:15 -0800 (PST) 
> lesssugar <rgozdz...@gmail.com <javascript:>> wrote: 
>
> > Hi everyone, I'm new to Git and not sure how to achieve my goal. 
> > 
> > I have an application hosted on a remote server. I would like to 
> > create a repo in the application folder, so I can clone all the files 
> > to my local machine and perform standard add/commit/push workflow. 
> > 
> > What are the steps to setup such connection with Git? 
>
> Well, on the surface the solutions is simple: 1) turn the app directory 
> into a Git repo, add (most of) the files, recursively, record an 
> initial commit; 2) provide access to this repository (SSH or HTTP[S] or 
> whatever). 
>
> But that's only in theory. 
> Git is not a deployment tool: 
> 1) You can't push to a branch in a remote repository which is 
>    there currently checked out. 
> 2) Git does not store file ownership and permission bits. 
> 3) Git does not know anything about databases, their schema changes 
>    and migration scripts. 
>
> For the usual website deployment, which in 99.9% is done in a rather 
> brain-dead fashion -- the www-data (or whatever system user used to run 
> the web server software) gets R/W access to the whole tree of files 
> constituting the website, -- (2) might be ignored, and for static 
> websites (3) might be ignored as well. 
>
> The solution to (1) is to use a so-called "bare" repository on the 
> server (this kind of repository does not contain the work tree) armed 
> with a post-receive hook -- a script which is run by Git when certain 
> event happens in the repository, reception of new commits in our 
> case -- performing actual update of files in a dedicated directory 
> using the latest (received) state of some branch. 
>
> Now I'll stop here and let you google for "git+web+deployment" for this 
> topic has accumulated countless blog posts by now. 
>
> As to how to turn your existing project into a bare Git repo... 
> I'd go like this (on ther server): 
>
> $ cp -lR /path/to/your/app /var/tmp/repo 
> $ cd /var/tmp/repo 
> $ git init 
> $ nano .gitignore 
>   ...add here masks for files you don't want, 
>      like .htaccess, *.swp, *~ etc 
> $ git add . 
> $ git commit -m 'Initial commit' 
> $ git config core.bare true 
> $ mv .git /path/to/your/git/repos/app.git 
> $ cd; rm -rf /var/tmp/repo 
>
> By now you have a directory app.git which is a bare repo 
> contatining a single commit on the branch named "master". 
>
> You can now access it after setting up SSH or HTTP or whatever to work 
> with Git [1], [2]. 
>
> 1. http://git-scm.com/book/en/Git-on-the-Server 
> 2. http://git-scm.com/blog/2010/03/04/smart-http.html 
>

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to