Why GitHub for AI Development?
GitHub is essential for version control, collaboration, and deploying AI projects. You'll use it to host your code, track changes, and deploy to platforms like Cloudflare Pages, Vercel, and Hugging Face.
Step 1: Create GitHub Account
- 1. Visit github.com and sign up
- 2. Choose a username (this will be in your repo URLs)
- 3. Verify your email address
- 4. Enable two-factor authentication (Settings → Password and authentication)
Step 2: Install Git
Git should already be on your Mac, but verify:
git --version
If not installed, use Homebrew:
brew install git
Step 3: Configure Git
Set your identity for commits:
git config --global user.name "Your Name"
git config --global user.email "[email protected]"
Optional: Set default branch to main:
git config --global init.defaultBranch main
Step 4: Set Up Authentication
Option A: Personal Access Token (Recommended)
- 1. GitHub → Settings → Developer settings → Personal access tokens → Tokens (classic)
- 2. Generate new token → Select scopes: repo, workflow, write:packages
- 3. Copy the token (you won't see it again!)
-
4.
Store in Keychain:
git credential-osxkeychain
Option B: GitHub CLI
brew install gh
gh auth login
# Follow prompts to authenticate
Essential Git Commands
git init
Initialize new repo
git clone <url>
Clone existing repo
git add .
Stage all changes
git commit -m "msg"
Commit changes
git push
Push to remote
git pull
Pull from remote
git status
Check repo status
git log --oneline
View commit history
Create Your First Repo
# Create project folder
mkdir my-ai-project
cd my-ai-project
# Initialize git
git init
# Create README
echo "# My AI Project" > README.md
git add README.md
git commit -m "Initial commit"
# Create repo on GitHub (using CLI)
gh repo create my-ai-project --public --source=. --remote=origin --push
🔧 Troubleshooting
Permission denied (publickey)
You need to set up SSH keys or use HTTPS with a personal access token.
Authentication failed
Your token may have expired. Generate a new one in GitHub settings.
Changes not appearing on GitHub
Make sure you've committed AND pushed: git add . && git commit -m "msg" && git push
🎉 GitHub is Ready!
You can now version control your AI projects. Next, set up iTerm2 for a better terminal experience, or start creating repositories for your AI workflows.