Changes between Initial Version and Version 1 of setup-git


Ignore:
Timestamp:
Nov 12, 2013, 4:27:13 PM (7 years ago)
Author:
Dana
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • setup-git

    v1 v1  
     1== How to Setup Git on server ==
     2
     3First thing to do is create a git repo with the command
     4
     51. Create a repository in webroot with the command
     6
     7{{{
     8git init
     9}}}
     10
     112. Using a text editor, create a .gitignore file
     12
     13The next thing to note is that you don't want any uploaded files or configuration files to be in the repository
     14
     15in that file (for WordPress sites) add the following lines:
     16
     17{{{
     18/wp-content/uploads
     19/wp-config.php
     20*~
     21/.htaccess
     22}}}
     23
     24Can be done by:
     25
     26
     27{{{
     28echo "/wp-content/uploads
     29}}}
     30 
     31
     32click enter
     33
     34Add
     35{{{
     36/wp-config.php
     37}}}
     38
     39
     40click enter
     41
     42add
     43
     44{{{
     45" >> .gitignore
     46}}}
     47
     48
     49click enter
     50
     51Also add
     52
     53
     54{{{
     55echo ".htaccess" >> .gitignore
     56}}}
     57
     58
     593. Add files to the git repository with the command
     60
     61{{{
     62git add .
     63}}}
     64
     65
     66Check status with
     67
     68{{{
     69git status
     70}}}
     71
     724. Do the initial commit with the command
     73
     74
     75{{{
     76git commit -am"Initial Commit"
     77}}}
     78
     79
     805. Create a bare repository outside webroot
     81
     82for example
     83
     84{{{
     85cd ../include && mkdir code
     86}}}
     87
     88The run
     89
     90{{{
     91cd code && git init --bare
     92}}}
     93
     94
     956. Add a remote to our main git repo with the command
     96
     97
     98{{{
     99git remote add code ../include/code
     100}}}
     101
     102
     1037. push our main repo to the remote with the command
     104
     105
     106{{{
     107git push code master
     108}}}
     109
     110
     1118. Add needed hooks for handling live and remote changes.
     112
     113A. Using a text editor (nano) with this command 'nano .git/hooks/post-commit.sample' (I think)
     114
     115Use this code
     116
     117
     118{{{
     119#!/bin/sh
     120
     121echo
     122echo "**** pushing changes to Hub [Prime's post-commit hook]"
     123echo
     124
     125git push code
     126}}}
     127
     128
     129Ctr-x
     130then y to save
     131hit enter
     132
     133The run
     134
     135{{{
     136mv .git/hooks/post-commit.sample .git/hooks/post-commit
     137}}}
     138
     139
     140B. add post-update hook in the bare repository
     141
     142
     143{{{
     144nano ../include/code/hooks/post-update.sample
     145}}}
     146
     147
     148Add the following
     149
     150
     151{{{
     152#!/bin/sh
     153
     154echo
     155echo "**** Pulling changes into Prime [Hub's post-update hook]"
     156echo
     157
     158
     159cd $HOME/cn.glocal.coop/web || exit
     160unset GIT_DIR
     161git pull code master
     162
     163exec git-update-server-info
     164}}}
     165
     166change the file name with the command
     167
     168{{{
     169mv ../include/code/hooks/post-update.sample ../include/code/hooks/post-update
     170}}}
     171
     172
     1739. From local web root initialize a git repo with the command
     174
     175{{{
     176git init
     177}}}
     178
     179
     180A. add a remote to the local repository with the command
     181
     182
     183{{{
     184git remote add code commnet@rose.mayfirst.org:cn.glocal.coop/include/code
     185}}}
     186
     187
     188B. Pull in the remote repo with the command
     189
     190
     191{{{
     192git pull code master
     193}}}
     194