Put the project on GitHub with a safe daily workflow
Create a private GitHub repository, protect it from leaked secrets, and learn the branch, commit and pull request routine with an automatic check.
You will have: Your code safely stored on GitHub, a main branch that always works, an automatic lint, typecheck and build check on every pull request, and one practice pull request merged.
Before you start
- A GitHub account with two-factor sign-in turned on (from Episode 2)
- The project from Episode 4 with at least one git commit
- Your agent running in the project folder
- A few minutes to approve a browser sign-in when the agent asks
Make it yours
Change the example (a fashion store) to your own. Your answers are saved in this browser and used in every episode.
Other series keywords (8)
Your prompt
Paste into: {{ai_agent}} running in your project folder.You are my coding agent working inside this project folder. I am a non-programmer. Explain every git and GitHub word the first time you use it, in one short sentence.
Context: this is the codebase of "Thread & Needle", a fashion e-commerce store. It is a Next.js project with one local git commit. I want it on GitHub with a workflow where the main branch always works and every change goes through a pull request. Read the rules file first and follow it.
Goal: a private GitHub repository, secret protection, an automatic check, and one practice pull request that I approve.
Plan first: show me your plan, including the repository name you propose, and wait for my OK before creating or pushing anything.
Tasks:
1. Check that git has my name and email, and that the default branch is main. Check whether the GitHub command-line tool (gh) is installed. If not, tell me how to install it from its official page, then ask me to run its sign-in command myself in the browser. Never ask me to paste a token.
2. Review .gitignore. It must ignore .env files (but keep .env.example), node_modules, build output and local editor or system files. Search the git history and the tracked files for anything that looks like a key, password or token. Show me what you searched and the result before the first push. If anything is found, stop and tell me.
3. Create a PRIVATE repository named after Thread & Needle (lowercase, with hyphens) and push main to it.
4. Turn on the security features GitHub offers for my account type: Dependabot alerts, and secret scanning with push protection. Secret scanning is free for public repositories; for private ones it may need a paid plan, so say clearly what is and is not available to me and tell me to verify on GitHub's pricing page.
5. Add a GitHub Actions workflow in .github/workflows that runs on every pull request and every push to main: install with a clean install command, then lint, typecheck and build. Give it read-only permissions and no secrets. Use a current Node version that matches my project.
6. Add a short pull request template with: what changed, how I checked it, and a tick-box saying no secrets were added.
7. Write a short CONTRIBUTING section in the rules file: work on a branch named like feat/short-name or fix/short-name, make small commits with clear messages in the present tense, open a pull request, wait for the check to pass, then merge. Never commit straight to main, never force-push, never skip checks.
8. If my plan supports it, set up branch protection so main requires a pull request and the check to pass. If not, tell me and rely on the written rule.
9. Practice: on a new branch, add a README with the store name, what the project is, and how to run it. Commit, push, open a pull request, wait for the check, show me the result, and ask me to approve before you merge. Then delete the branch and update local main.
Security rules: never print, log or commit secrets. If push protection blocks a push, do not bypass it; tell me.
Verify and show me: the repository address, the status of each security feature, the passing check on the pull request, and git log on main.
Report back in this format:
1. Done: what was set up
2. Check: what I should look at on the GitHub website
3. My decisions: anything that needs my choice, such as making the repository public laterReview the prompt, then copy it. Never paste real passwords or API keys into a chat.
How to check it worked
- Your GitHub account shows a private repository with the project files and no .env.local file in it
- The Settings page of the repository shows which security features are on, and the agent told you what your plan does not include
- The practice pull request shows a green tick for the automatic check
- The README appears on the main page of the repository after the merge
- git log on main shows small commits with clear messages
Sample result
Fashion store exampleExample result for the fashion store: the practice pull request and the repository security status.
If something goes wrong
- The agent says gh is not signed in, or the sign-in page does not open.
- Run the sign-in command yourself in your editor's terminal and choose the browser option. Follow the one-time code steps shown there. Never paste a token into the chat.
- The push is rejected, or GitHub says a secret was detected.
- Do not bypass the block. Ask the agent which file contains the secret, remove it from the commit, and rotate (replace) the secret at its provider, because a pushed secret must be treated as leaked.
- The automatic check fails on the pull request.
- Open the failed check on GitHub and paste the error into the agent with: "Explain this failure in plain words and fix it on this branch." Do not merge until it is green.
- Branch protection or secret scanning is not offered for your private repository.
- This depends on your GitHub plan. Keep the rule written in your rules file, keep the repository private, and consider the options on GitHub's pricing page. Never make a repository public just to get a feature before checking it contains no secrets.
A GitHub account and private repositories are free to start. Which security features and how many automatic-check minutes you get depend on your plan and on whether the repository is public or private, so verify on GitHub's pricing page.
More in Foundation
- Episode 6Build the store database on your computer
- Episode 7Give your store a brand, a design system and a home page
This is part of the series Build a secure, no-cost e-commerce website with AI agents. See all 24 episodes, the tools used and answers to common questions on the series page.