Create a GitHub Account
O GitHub is a website where you can store your code online for free. Before you upload anything, you need an account. It’s quick: it’s the same process as creating an account on any website, but with one important detail that many people get confused about at first: git and GitHub are not the same thing.
Step-by-step account creation
- 1.Access
github.comand click Sign up. - 2.Enter your email. Use one you actually have access to (you'll need to confirm).
- 3.Create a password strong and choose one username (username). This name will appear in your projects' URLs, e.g.:
github.com/seunome. - 4.Resolve the verification challenge (anti-bot puzzle).
- 5.Open your email, copy the confirmation code and paste it into GitHub. Done.
🧠 Analogy: Git Is the Photo App, GitHub Is the Cloud
Think of the git like the photo app on your phone: it organizes things, saves versions, and everything stays on your machine. The GitHub and the cloud (like Google Photos): you upload a copy to the internet, where it stays safe even if your phone breaks, and other people can see it.
- •git = a program on your computer that controls versions (offline, local)
- •GitHub = a website where you store and show your code (online, cloud)
- •You use Git to make commits and GitHub to store those commits in the cloud
💡 Tip: choose your username carefully
Your username is almost like a professional business card. Choose something simple and professional (e.g., joaosilva) instead of nicknames. It becomes part of your GitHub Pages site URLs, so choose something you'd put on a resume.
Access Tokens (PAT)
Here’s a surprise: your GitHub password no longer works for sending code from the terminal. For security, GitHub requires a token (Personal Access Token, or PAT). It's like a disposable password with specific permissions, just for the terminal.
🧠 Analogy: A Token Is a Hotel Key
Your password is the master key that opens everything. A token is like a hotel room key card: it opens only what it needs to, expires on its own, and if you lose it, you can simply revoke it and generate another one without changing the entire lock. That’s why GitHub prefers that you use a token in the terminal, not your password.
How to create a Personal Access Token
- 1.On GitHub, click your profile picture (top right) → Settings.
- 2.Scroll to the bottom of the side menu → Developer settings.
- 3.Personal access tokens → Tokens (classic) → Generate new token.
- 4.Give a name (e.g., "my-pc"), set the validity (e.g., 90 days) and select the scope
repo. - 5.Click Generate token e COPY it right away. It only appears once.
👁 What you’ll see on the screen
# After generating it, a token like this appears:
ghp_A1b2C3d4E5f6G7h8I9j0K1l2M3n4O5p6Q7r8
# On the first push, the terminal asks for:
Username: seunome
Password: (paste the token here, NOT the password)
When the terminal asks for “Password,” paste the token, not your password. The password will be rejected.
✓ What TO DO
- ✓Store the token in a password manager
- ✓Check only the scope you need (
repo) - ✓Set an expiration date and generate another one when it expires
✗ What NOT to do
- ✗Pasting the token into the project code
- ✗Send the token to someone by email or chat
- ✗Check ALL scopes unnecessarily
⚠️ Common Error
Problem: when running git push, it appears Authentication failed or Support for password authentication was removed.
Solution: this is almost always a token expired or you entered the password instead of the token. Generate a new token in Settings > Developer settings > Tokens, and paste it in place of the password when the terminal prompts you.
Connect Local and Cloud
You already have a project with Git on your computer (previous module) and a GitHub account. All that’s left is start both. You do this with four main commands: remote add, push, pull e clone.
git remote add + git push - Send to the cloud
First, you create an empty repository on GitHub (button New). It shows you the URL. Then, in the terminal, inside the project folder:
# Point the local project to the cloud repo
$ git remote add origin https://github.com/yourname/my-site.git
# Rename the main branch to main (GitHub standard)
$ git branch -M main
# Send everything for the first time (-u connects both ends)
$ git push -u origin main
Enumerating objects: 5, done.
Writing objects: 100% (5/5), 612 bytes, done.
To https://github.com/seunome/meu-site.git
* [new branch] main -> main
branch 'main' set up to track 'origin/main'.
origin is just a nickname for the repo URL. The -u connects your local branch to the remote one, so after that all you need to do is git push.
git pull - Pull changes from the cloud
When you (or a colleague) change something directly on GitHub, use pull to download these changes to your computer.
$ git pull
remote: Enumerating objects: 3, done.
Updating a1b2c3d..d4e5f6g
Fast-forward
index.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
git clone - Download an entire repo
To start working on a project that already exists in the cloud (yours or someone else's), use clone. It downloads everything and connects the origin automatically.
$ git clone https://github.com/yourname/my-site.git
Cloning into 'meu-site'...
remote: Counting objects: 100% (8/8), done.
Receiving objects: 100% (8/8), done.
$ cd meu-site
# Ready, you can edit and push now
💡 Tip: the day-to-day cycle
The routine is always the same: git pull (get the latest changes) → edit → git add . → git commit -m "..." → git push. Pull at the beginning, push at the end.
GitHub Pages: Enable and Publish
Here’s where the magic happens: GitHub takes the code from your repo and publishes as a real website on the internet, with its own free address. This is called GitHub Pages. In just a few clicks, your HTML becomes a link anyone in the world can open.
Open the repo settings
In your GitHub repository, click the tab Settings (at the top). In the left sidebar menu, click Pages.
Choose the branch
Under "Source," select Deploy from a branch. Under "Branch," choose main and the folder / (root). Click Save.
Wait for the build
GitHub takes 30 seconds to a few minutes to build the site. Refresh the page and the green link with the address will appear soon. Be patient the first time.
👁 What you’re going to see
# After the build, a green box appears:
✓ Your site is live at
https://seunome.github.io/meu-site/
The address format is usuario.github.io/repo. Click the link and your site opens in the browser, live for the whole world.
⚠️ Common Error
Problem: I open the URL and it appears 404 or a blank page.
Solution: check three things. (1) Your main file needs to be named index.html is to be at the root of the repo. (2) The build may not have finished yet, so wait a little longer and reload. (3) The branch selected in Pages must be the one that contains the code (main).
AI in Code: Codex and Copilot
GitHub doesn't just store code: it also offers artificial intelligence assistants that write code with you. The most famous are GitHub Copilot and models like Codex. They autocomplete lines, generate entire functions, and answer your questions inside the editor.
🧠 Analogy: A Real Copilot
Think of a flight: you’re the pilot, but there’s a copilot beside you who already knows the route and suggests the next step. You make all the decisions, but they handle the busywork. Copilot does this with code: you start typing, and it suggests the rest in gray. Press Tab to accept, or ignore it.
🤖 GitHub Copilot
An extension you install in VS Code. As you type, it suggests the next part of the code in real time (smart autocomplete).
- •Gray suggestions as you type
- •Chat to get help in the editor
- •Tab accepts, Esc discards
⚡ Codex and assistants
AI models (such as Codex) that generate code from a description in Portuguese. You ask for what you want, and it writes the code.
- •Generate entire functions from text
- •Explain code you don’t understand
- •Speed up repetitive tasks
👁 What you’ll see in the editor
# You write just a comment:
// function that adds two numbers
# Copilot suggests the rest (in gray):
function soma(a, b) {
return a + b;
}
# You press Tab and the code appears ready to use
💡 Tip: AI speeds things up, but you decide
These assistants greatly increase productivity, but they sometimes make mistakes. Always read and understand what the AI generated before you accept it. Use it as a shortcut for the grunt work, not as a substitute for learning. Whoever understands the code is in charge of the AI, not the other way around.
Exercise: From Zero to Push
Time to put it all together. You’ll create a repository from scratch, connect it to GitHub, and send your first project to the cloud. In the end, your code will be online, saved, and ready to become a website.
🎯 What you'll achieve
A repository on GitHub called meu-primeiro-repo with a file uploaded, visible in your account for the world to see.
Step 1: Create the repo on GitHub
On the site, click the + (upper-right corner) → New repository. Name: meu-primeiro-repo. Leave public e no check "Add a README". Click Create repository.
Step 2: Set up the project locally
$ mkdir meu-primeiro-repo
$ cd meu-primeiro-repo
$ git init
Initialized empty Git repository
Step 3: Create and save a file
$ echo "# My First Repo" > README.md
$ git add .
$ git commit -m "first commit"
[main (root-commit) a1b2c3d] first commit
1 file changed, 1 insertion(+)
Step 4: Connect to GitHub
# Use the URL GitHub showed you
$ git remote add origin https://github.com/yourname/my-first-repo.git
$ git branch -M main
Step 5: Upload to the cloud
$ git push -u origin main
# When prompted, paste the TOKEN in the password field
Username: seunome
Password: ghp_xxxxxxxxxxxx
* [new branch] main -> main
Step 6: Check in the browser
Open github.com/seunome/meu-primeiro-repo. Your README.md is up in the cloud for the world to see.
✓ What TO DO
- ✓Give
commitbefore trying to push - ✓Pasting the token when prompted for the password
- ✓Check the repo in the browser afterward
✗ What NOT to do
- ✗Check "Add README" when creating (causes a conflict on push)
- ✗Type the password instead of the token
- ✗Forget the
git initbefore anything else
🏆 Congratulations!
Your code now lives in the cloud. You know how to create an account, generate a token, connect local and remote, and publish. In the next module, you'll bring everything together in a real end-to-end project: a landing page from scratch through deployment.
📚 Module Summary
Next Module:
1.4 - Project: Landing Page (bring terminal, git, and GitHub together in a real project from scratch to deploy)