git for managing web public html directory


On GitServer [ ip:192.168.0.123 ]

useradd gituser1 -m -s /bin/bash

mkdir -p /project/ecommerceweb
chown -R gituser1:gituser1 /project


cd /project/ecommerceweb
git init --bare

Note:-To have separate worktree

vim /project/ecommerceweb/hooks/post-receive

#!/bin/bash
GIT_WORK_TREE=/webdir/web git checkout -f

#<save/exit>

chmod +x /project/ecommerceweb/hooks/post-receive



On git client [ ip:192.168.0.123 ]

#copy your ssh public key to git server for user "gituser1" for passwordless ssh and public/private key based authentication

ssh-copyid gituser1@192.168.0.239

git clone ssh://gituser1@192.168.0.239/project/ecommerceweb
cd ecommerceweb
vim index.php
... < add your code /save/exit> ..

git add . # add files to index
git commit -m "initial commit added index page" #Record changes to the repository
git push origin master #push changes to git server
git status

git remote show origin #shows your remote gitserver url OR use

git config --get remote.origin.url



View changed files in your working repository

## git status

Git log

show all git commits

## git log

Git diff

made changes to tracked files

## git diff

Git branch

list all branches

## git branch


No comments:

Post a Comment