🐙 GitHub and repositories
Bring your local repository to the cloud: create repos, configure SSH, use the gh CLI in the terminal, open PRs, and write an impressive README. GitHub is your professional showcase.
🏗️ Create a repository
Web vs. gh CLI — two paths to the same destination
Via gh CLI (recommended)
$ gh repo create meu-projeto --public --clone
$ gh repo create meu-projeto --private --add-readme
$ gh repo create # modo interativo (pergunta tudo)
Connect an existing local repo to GitHub
$ git remote add origin git@github.com:user/repo.git
$ git push -u origin main
$ git remote -v # confirma remote configurado
✓ Public repo: ideal for your portfolio
- ✓Indexed by Google and GitHub search
- ✓Free and unlimited GitHub Pages
- ✓External contributors can help
🔒 Private Repo: For Internal Projects
- →Code not publicly exposed
- →Collaborators need an invitation
- →GitHub Pages requires a paid plan (except for organizations)
📡 Remote and push
Sync local with GitHub — the loop you’ll repeat every day
Push sends, pull receives — GitHub is the central sync point.
$ git push -u origin main # primeiro push + configura tracking
$ git push # pushes seguintes (tracking já configurado)
$ git pull # baixa + mescla mudanças remotas
$ git fetch # baixa SEM mesclar (mais seguro)
$ git remote -v # lista remotes configurados
$ git remote set-url origin URL # muda a URL do remote
💡 push --force-with-lease: the safe way
Never use git push --force on a shared branch — it destroys other people's work. Use --force-with-lease: only forces it if no one has pushed before you.
🔑 SSH vs HTTPS
Authenticate once, work forever without entering a password
SSH — recommended for daily use
- ✓Key pair: the public key stays on GitHub, the private key stays on your computer
- ✓No need to type your password with every push/pull
- ✓URL:
git@github.com:user/repo.git - ✓Works perfectly with Claude Code in automation
HTTPS — simpler to configure
- →Personal access token (PAT) instead of a password
- →URL:
https://github.com/user/repo.git - →Credential helper caches the token
- →Easier to use behind corporate firewalls
# 1. Gerar chave
$ ssh-keygen -t ed25519 -C "seu@email.com"
# pressione Enter para aceitar o caminho padrão (~/.ssh/id_ed25519)
# 2. Copiar a chave pública
$ cat ~/.ssh/id_ed25519.pub
# copie todo o output e cole em GitHub → Settings → SSH keys → New SSH key
# 3. Testar conexão
$ ssh -T git@github.com
Hi usuario! You've successfully authenticated, but GitHub does not provide shell access.
# 4. Mudar remote existente de HTTPS para SSH
$ git remote set-url origin git@github.com:user/repo.git
⚡ gh CLI
GitHub in the terminal—create repos, PRs, releases, and much more without opening a browser
🤖 Claude Code Uses gh Extensively
When you ask Claude Code to create PRs, check CI/CD, make releases, or open issues, it uses gh behind the scenes. Understanding the commands lets you audit what was done and customize the behavior.
# Autenticação
$ gh auth login # autentica com GitHub
$ gh auth status # verifica autenticação
# Repositórios
$ gh repo create nome --public --clone # cria e clona
$ gh repo view # detalhes do repo atual
$ gh repo clone user/repo # clona repo
# Pull Requests
$ gh pr create --title "feat: X" --body "Descrição"
$ gh pr list # lista PRs abertos
$ gh pr merge --squash --delete-branch # merge com squash
# Issues
$ gh issue create --title "Bug: X" --label bug
$ gh issue list --label "good first issue"
# Releases
$ gh release create v1.0.0 --generate-notes
$ gh release list
# GitHub Actions / CI
$ gh run list # lista execuções recentes
$ gh run watch # monitora execução em tempo real
⚡ Install gh CLI
# macOS: brew install gh
# Ubuntu/Debian: sudo apt install gh
# Windows: winget install GitHub.cli
🔀 Pull requests
Structured collaboration — review before merge
Create a branch + commit + push
git checkout -b feature/nova-funcao
git add . && git commit -m "feat: adiciona nova funcão"
git push -u origin feature/nova-funcao
Open the PR via the gh CLI
gh pr create \
--title "feat: adiciona nova funcão" \
--body "## O que faz\n- Item 1\n\n## Como testar\n- Passo 1" \
--base main
Review, approve, and merge
gh pr review --approve # aprovar
gh pr merge --squash --delete-branch # merge com squash
gh pr checks # verificar CI
📖 Effective README
The project’s first impression — the difference between being ignored and starred
# 🚀 Nome do Projeto
> Uma linha descrevendo o que faz e para quem.


## ✨ O que faz
Lista rápida com os principais benefícios.
## 🛠️ Tecnologias
- Lista de tecnologias usadas
## 🚀 Como usar
```bash
git clone ...
npm install
npm start
```
## 📸 Preview
[screenshot ou GIF aqui]
## 📄 Licença
MIT — veja LICENSE para detalhes.
✓ README that works
- ✓First sentence: explains the project in 10 seconds
- ✓Screenshot or GIF above the fold
- ✓Installation in fewer than 3 commands
- ✓Visual status, license, and version badges
✗ README that turns people away
- ✗Empty README or "TODO"
- ✗No installation instructions
- ✗Walls of unformatted text
- ✗Not updated after project changes
🤖 Claude Code generates a README
Ask: "Analyze this project and generate a complete README.md with badges, installation, usage, and real examples." Claude reads the code and generates accurate documentation in seconds.
🎯 Module summary
What you learned
- ✓Create a repository via gh CLI or the web
- ✓Configure the remote and push/pull
- ✓SSH with ed25519 — passwordless authentication
- ✓gh CLI: repos, PRs, issues, releases
- ✓Complete Pull Request flow
- ✓Well-structured README that impresses
Next module
With the repository on GitHub, the next step is to publish it for free with GitHub Pages—and make your project accessible to the whole world in minutes.
Module 6.3 — GitHub Pages→