xiaohongshu
xiaohongshu
configure-git-webserver
Guidance for setting up Git-based web deployment systems where pushing to a Git repository automatically deploys content to a web server. This skill should be used when tasks involve configuring bare Git repositories with post-receive hooks for automated web deployment, setting up lightweight web...
Full skill instructions
This skill provides guidance for configuring Git-based web deployment systems where content is automatically deployed to a web server when pushed to a Git repository.
This skill applies to tasks involving:
git push triggers deployment)Before starting implementation, verify the environment:
Check available tools and permissions
sudo is available: command -v sudocommand -v nginx, command -v python3git --versionwhoami, idConfigure Git identity proactively
git config --global user.name "Deploy" && git config --global user.email "deploy@localhost"Identify port availability
lsof -i :PORT or ss -tlnp | grep PORT# Create the bare repository directory
mkdir -p /git/server
cd /git/server
git init --bare
A bare repository has no working directory and is designed for remote operations.
# Create web root with appropriate permissions
mkdir -p /var/www/html
chmod 755 /var/www/html
Document why this directory was chosen (standard location, permissions, etc.).
The post-receive hook triggers after each push. Critical considerations:
#!/bin/bash
# /git/server/hooks/post-receive
# Handle multiple branch naming conventions
while read oldrev newrev refname; do
branch=$(echo $refname | sed 's/refs\/heads\///')
if [ "$branch" = "main" ] || [ "$branch" = "master" ]; then
GIT_WORK_TREE=/var/www/html git checkout -f $branch
echo "Deployed $branch to /var/www/html"
fi
done
Make executable: chmod +x /git/server/hooks/post-receive
Hook considerations:
main and master branch names-f) to overwrite local changescd /var/www/html
python3 -m http.server 8080 &
Limitations: No auto-restart, no production features, terminates with session.
For persistent service, create a systemd service or use a process manager. See references/deployment_checklist.md for service configuration patterns.
Test the actual use case, not just components:
Local clone test (basic validation):
git clone /git/server /tmp/test-clone
cd /tmp/test-clone
echo "test" > index.html
git add . && git commit -m "test" && git push origin main
Remote SSH test (full validation):
git clone user@server:/git/server /tmp/remote-test
This validates the SSH access path that users will actually use.
Web server verification:
curl http://localhost:8080/index.html
Cleanup test artifacts:
rm -rf /tmp/test-clone /tmp/remote-test
Problem: Background processes (command &) terminate when session ends.
Solution:
nohup for slightly better persistence: nohup python3 -m http.server 8080 &Problem: Different users pushing may not have write access to web directory.
Solutions:
chgrp -R webgroup /var/www/html && chmod -R g+w /var/www/htmlProblem: git commit fails during testing without user.name/user.email.
Solution: Configure Git identity at the start of implementation, not when errors occur.
Problem: Web server fails to start because port is already in use.
Solution:
fuser -k 8080/tcpProblem: Testing with local paths doesn't validate SSH-based remote access.
Solution: Test both local (/git/server) and remote (user@server:/git/server) access patterns when SSH is part of the requirements.
Problem: Post-receive hook doesn't run after push.
Checklist:
chmod +x hooks/post-receive#!/bin/bashbash -n hooks/post-receiveProblem: git checkout -f overwrites files modified directly in web directory.
Consideration: This is usually desired behavior for deployment, but document it for users who may manually edit deployed files.
Before marking task complete, verify:
sudo may not be available; adapt paths accordinglyxiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience