STEP 01Prepare the repository locally
Commit a lockfile, document runtime versions and production commands. Check git status before pushing. Keep uploads, local environments and databases outside Git. The example ignore rules below are a starting point, not a substitute for reviewing files.
node_modules
.git
.env
.env.*
!.env.example
.next
uploads
*.sqlite*STEP 02Give the server the smallest useful access
For a private repository, use a read-only deploy key scoped to that repository or another supported scoped credential. Generate the key on the server and add only its public part to GitHub. Verify GitHub’s SSH host fingerprints against official documentation. Do not copy a personal account token into a command URL.
STEP 03Clone into a folder you own
Use a non-root deployment account. Replace OWNER and REPO. The commands below create a directory in that account’s home; they do not alter any existing application.
mkdir -p ~/apps
cd ~/apps
git clone git@github.com:OWNER/REPO.git my-app
cd my-app
git rev-parse --short HEAD
git status --shortSTEP 04Deploy a known revision
Record the commit that passed your checks. Install dependencies using the project lockfile and build using its documented production script. Store environment secrets separately. For updates, prepare a new release, verify health and switch traffic with a rollback route; avoid blindly pulling into a live working tree.
COPY → YOUR AI
Take the next step to your AI.
A safe starting prompt for this guide. No secrets. Works with ChatGPT, Claude and other assistants.
Sources and technical documentation
GitHub deploy keys ↗This recipe is a pattern for the stated prerequisites. Verify project compatibility and your actual server configuration before applying it to a live service.