Walkthrough · Project build
Ship your first web project
GitHub
Put your code online, so it is backed up and ready to deploy.
GitHub stores your project and its full history, so a broken laptop is not a lost project. It is also how hosts get your code: once they are connected, every push to GitHub updates your live site. A GitHub account is free.
1. Save your latest changes. create-next-app already made a first commit for you. From your project folder (cd ~/projects/my-project), save what you have changed since:
bash
git add -A
git commit -m "my first changes"What you should see
A short summary of the files you changed, and a commit ID. If git says nothing to commit, you have not changed anything yet, which is fine. If git asks who you are, set your name and email with git config, then run the commit again.2. Create a GitHub account at github.com, if you do not have one. Use the same email you gave Git in the Setup step.
3. Make an empty repository. On GitHub, click the + at the top right, then New repository. Name it my-project. Public or Private both work. Leave the README, .gitignore and license options switched off. Your project already has its own, and an extra file on GitHub makes your first push fail.
4. Connect and push. Your new repository page shows a section headed ...or push an existing repository from the command line. Copy those three lines and run them in your project folder. They look like this, with your own username:
bash
git remote add origin https://github.com/YOUR-USERNAME/my-project.git
git branch -M main
git push -u origin mainWhat you should see
The first time, you are asked to sign in (see below). Then a few lines counting and writing objects, ending with branch main set up to track origin/main. Refresh your repository page on GitHub and your files are there.Signing in the first time
A window pops up asking you to connect to GitHub. Choose Sign in with your browser, approve it on the page that opens, and the push carries on by itself. Git for Windows remembers you, so this only happens once.
GitHub does not accept your account password in the terminal. Instead, sign in once with GitHub's own tool before you push. Install GitHub CLI from cli.github.com (it has a Mac installer), open a new Terminal window, and run:
bash
gh auth loginWhat you should see
A few questions. Choose GitHub.com, then HTTPS, then Yes to authenticate Git, then Login with a web browser. It shows a one-time code: copy it, press Enter, paste it into the page that opens and approve. The terminal ends with Logged in as your username.Now run git push -u origin main again. It will not ask you to sign in.
GitHub does not accept your account password in the terminal. Instead, sign in once with GitHub's own tool before you push. Install GitHub CLI using the instructions for your system on cli.github.com, then run:
bash
gh auth loginWhat you should see
A few questions. Choose GitHub.com, then HTTPS, then Yes to authenticate Git, then Login with a web browser. It shows a one-time code: copy it, press Enter, paste it into the page that opens and approve. The terminal ends with Logged in as your username.Now run git push -u origin main again. It will not ask you to sign in.
Stuck? Pick a prompt and ask your AI tool
I am trying to put my first project on GitHub and got stuck. What I ran: [paste the commands] What I saw: [paste the full message] Explain what went wrong in plain words and give me the exact commands to fix it, one step at a time. I am a beginner, so do not skip steps.
Open it in your AI tool. Clicking copies the prompt, and ChatGPT and Grok open with it already filled in.
- Claude(opens in a new tab)
- ChatGPT(opens in a new tab)
- Qwen(opens in a new tab)
- DeepSeek(opens in a new tab)
- Kimi(opens in a new tab)
- Grok(opens in a new tab)
More tools
App builders, in your browser:
Code editors on your computer. Open app only works once it is installed, so use Get it first if you do not have it.
- CursorOpen appGet it(opens in a new tab)
- VS CodeOpen appGet it(opens in a new tab)
- Antigravity IDEOpen appGet it(opens in a new tab)
- Antigravity 2.0Open appGet it(opens in a new tab)
Want the full list? Browse all app builders and coding editors (IDEs).
- Saved my changes with a commit
- Created a GitHub account
- Pushed the code to GitHub
- Sign in to tick these off and pick up where you left them.
Tools used in this build
Everything this walkthrough reaches for, with the directory entry for each.