4 · Initialize the repository
Objective — expand the bootstrap git from Create the project into the full import repo: merge Code & repository setup ignore rules, set identity, wire develop, and lock down per-directory storage ignores — without re-running git init if .git/ already exists.
Background
Section titled “Background”The single most important ordering rule: .gitignore before the first commit that could track secrets or vendor/. Create the project already ran bootstrap git init, committed the pristine vendor baseline on author/v* + tag, and set develop — this page merges Code & repository setup patterns (remote prep, storage subtree, vault paths) without recreating the import. If you somehow skipped Create the project, write .gitignore first, then git init, then run pristine baseline commit before continuing.
1. Set session variables
Section titled “1. Set session variables”Export your project’s values once so every command here (and on the next pages) is copy-paste safe. Pull them from your ProjectCard.
-
Export the project variables.
Terminal window export PROJECT_NAME="<project>"export VERSION="x.y.z" # replace with the vendor's semverexport GITHUB_REPO="git@github.com:<your-org>/<project>.git"export GIT_USERNAME="Your Name"export GIT_EMAIL="<you>@users.noreply.github.com"echo "Project: $PROJECT_NAME · Version: $VERSION · Repo: $GITHUB_REPO"# Expected: the echoed line shows your real project / version / repo values- ✅ The echo prints your actual project, version, and repo — no
<placeholder>left.
- ✅ The echo prints your actual project, version, and repo — no
2. Merge .gitignore (bootstrap → Code & repository setup)
Section titled “2. Merge .gitignore (bootstrap → Code & repository setup)”If Create the project ran, keep its anchored patterns (/vendor/, /_source/, !.env.tpl when using 1Password, .vscode negation from C2). Add or reconcile the lines below — do not replace the whole file blindly. The bootstrap block lives on Create the project §4; this page only adds Phase-2 deltas.
Write or merge the ignore file so the very next git status stays clean.
flowchart LR A[".gitignore<br/>merged / written"] --> B{"git init<br/>already?"} B -->|no| C["git init"] B -->|yes| D["skip init"] C --> E["git branch -M develop"] D --> E E --> F["git config<br/>user.name / user.email"]-
Write a baseline
.gitignorefor a CodeCanyon Laravel app..gitignore # Dependencies/vendor//node_modules/# Secrets (never commit).env.env.*!.env.example!.env.tpl# Laravel generated/storage/*.key/bootstrap/cache/*.php# Archive — NEVER in git (AI System bootstrap)/_source/# OS & IDE — .vscode/*.json committed at C2 (machine setup); keep negation if present.DS_Store/.idea//.vscode/*!/.vscode/extensions.json!/.vscode/settings.json!/.vscode/launch.json# Logs & testing*.log.phpunit.result.cache# CodeCanyon ZIPs*.zip# Agent/browser automation state (can contain cookies, auth headers, PII)/.playwright-mcp/*!/.playwright-mcp/.gitkeep/.browser-mcp//test-results//playwright-report/# Build — comment out the next line if you use the Build-Locally strategy# /public/build/# Project vault (credentials)/Admin-Local/1-Project/2-ProjectVault/- ✅
.gitignoreexists at the repo root before anygitcommand runs.
- ✅
-
Keep the Playwright MCP folder present but empty.
Terminal window mkdir -p .playwright-mcptouch .playwright-mcp/.gitkeepgit check-ignore .playwright-mcp/session.json && echo "✅ browser state ignored"# Expected: ✅ browser state ignored- ✅ Only
.playwright-mcp/.gitkeepis eligible for git; generated browser state is ignored.
- ✅ Only
You ignore vendor/ so it never bloats history — but you do not delete the shipped tree (see Extract & snapshot).
3. Initialize or confirm git on develop
Section titled “3. Initialize or confirm git on develop”-
Init only if needed, confirm
develop, set identity — do not deleteauthor/v*branches.Terminal window if [ ! -d .git ]; then git init; figit branch --show-current # expect develop after AI System setupgit branch -M develop 2>/dev/null || true # no-op if already developgit config user.name "$GIT_USERNAME"git config user.email "$GIT_EMAIL"git branch --list 'author/*'# Expected: develop current; author/vX.X.X still present from Create the project baseline- ✅
git branch --show-currentprintsdevelop;author/v*branch still listed;user.name/user.emailare set.
- ✅
develop and the frozen author/vX.X.X baseline already exist from AI System setup. Commit & freeze pushes them — it does not recreate the import commit.
4. Lock down storage ignores
Section titled “4. Lock down storage ignores”Laravel’s storage/ subtree must keep its folders in git but ignore their contents. Backfill any missing per-directory .gitignores.
-
Backfill the per-directory storage ignores.
Terminal window for dir in storage/app storage/app/public storage/framework \storage/framework/cache storage/framework/sessions \storage/framework/views storage/logs; do[ -f "$dir/.gitignore" ] || { mkdir -p "$dir"; printf "*\n!.gitignore\n" > "$dir/.gitignore"; }done# Expected: each storage subdir ends up with a "* / !.gitignore" ignore file- ✅ Every
storage/**directory carries a.gitignore.
- ✅ Every
-
Confirm the root ignore catches the big three before you stage anything.
Terminal window grep -E "^/vendor|^/node_modules|^\.env$" .gitignore # all three should print# Expected: three matching lines (/vendor, /node_modules, .env)- ✅ All three patterns print, and
git statusshows novendor/,node_modules/, or.env.
- ✅ All three patterns print, and
-
Prove lock files are not ignored.
Terminal window for f in composer.lock package-lock.json pnpm-lock.yaml yarn.lock; dotest -e "$f" || continuegit check-ignore -q "$f" && echo "❌ ignored: $f" || echo "✅ tracked-capable: $f"done# Expected: every existing lock file is tracked-capable- ✅ Lock files remain commit-capable so dependency versions are reproducible.
-
Match
/public/buildto the chosen asset strategy.Terminal window if grep -q '^/public/build/' .gitignore; thenecho "Strategy: build-on-server or CI artifact upload"elsetest -f public/build/manifest.json && echo "Strategy: build locally and commit public/build"fi# Expected: the printed strategy matches your deploy plan- ✅
.gitignoreand the deploy asset strategy agree.
- ✅
Checklist
Section titled “Checklist”Do not mark this step done until every box below is checked.
- 🤖 Session variables exported —
PROJECT_NAME,VERSION,GITHUB_REPO, identity. - 🤖
.gitignoremerged — AI System bootstrap anchors preserved; Code & repository setup patterns added; lock files not ignored. - 🤖 Tree clean —
git statusshows novendor/,node_modules/, or.env. - 🤖 On
develop—user.name/user.emailconfigured. - 🤖 Storage ignores in place — each
storage/**directory carries a.gitignore.