DevOps 2025-09-11
Git Basics for Server Management
Initial Setup
git config --global user.name 'Your Name'
git config --global user.email 'you@example.com'Key Commands
git clone https://github.com/user/repo.git
git pull origin main
git add .
git commit -m 'update'
git push origin mainDeploy with Git Hooks
# On server: setup bare repo
git init --bare /srv/myapp.git
# post-receive hook
GIT_WORK_TREE=/var/www/myapp git checkout -f
#Sudofree#Git Basics Server