GitHub Setup Complete Guide: From Zero to First Repository
GitHub confused me at first. All this talk about repositories, commits, pushes, pulls - it sounded complicated. But once I actually sat down and learned it, I realized it's not that hard. And it's incredibly useful, even if you're not a programmer.
This guide will take you from zero to having your first repository on GitHub. No prior experience needed. By the end, you'll understand the basics and be able to use GitHub for your projects.
What is GitHub, Anyway?
GitHub is basically cloud storage for code. But it's way more than that - it tracks changes, lets you collaborate, and keeps a history of everything. Think of it like Google Docs, but for code files.
Even if you're not a programmer, GitHub is useful for:
- Backing up your code projects
- Sharing your work
- Collaborating with others
- Showing your work to potential employers
- Version control (seeing what changed and when)
Step 1: Create a GitHub Account
Go to github.com and click "Sign up". Use your email, pick a username (you can't change it easily later, so choose wisely), and create a password. They'll send you a verification email - click the link to verify.
When you sign up, they'll ask if you want the free plan or paid. For most people, free is fine. You get unlimited public repositories (anyone can see them) and unlimited private repositories (only you can see them).
Step 2: Install Git
GitHub is the website, but Git is the software that actually does the version control. You need both.
On Windows: Go to git-scm.com, download Git for Windows, and install it. During installation, just use the default options - they're fine.
On Mac: Git might already be installed. Open Terminal and type git --version. If you get a version number, you're good. If not, install Xcode Command Line Tools (it'll prompt you) or download from git-scm.com.
On Linux: Use your package manager. For Ubuntu/Debian: sudo apt install git
Step 3: Configure Git
Open Terminal (Mac/Linux) or Git Bash (Windows) and tell Git who you are:
git config --global user.name "Your Name"
git config --global user.email "your.email@example.com"
Use the same email you used for your GitHub account. This connects your local Git to your GitHub account.
Step 4: Create Your First Repository on GitHub
Log into GitHub and click the "+" icon in the top right, then "New repository". Give it a name (like "my-first-project"), add a description if you want, choose public or private, and click "Create repository".
Don't check "Initialize this repository with a README" - we'll do that manually. Just create an empty repository.
Step 5: Connect Your Local Computer to GitHub
Now we need to connect your computer to GitHub. There are two ways: HTTPS (easier) or SSH (more secure, but more setup). Let's start with HTTPS.
On your repository page, click the green "Code" button and copy the HTTPS URL (it'll look like https://github.com/yourusername/repo-name.git).
Step 6: Create a Local Project
On your computer, create a folder for your project. Open Terminal/Git Bash, navigate to that folder (use cd to change directories), and run:
git init
This initializes Git in that folder. Now create a simple file - maybe a text file or a simple HTML file. Just something to test with.
Step 7: Make Your First Commit
A commit is like saving a snapshot of your project. Here's how to do it:
- Add files:
git add .(the dot means "all files in this folder") - Commit:
git commit -m "First commit"(the -m is your message describing what changed)
That's it. You've made your first commit. The files are now tracked by Git.
Step 8: Push to GitHub
Now let's upload it to GitHub:
- Add the remote:
git remote add origin https://github.com/yourusername/repo-name.git(use your actual URL) - Push:
git push -u origin main
It'll ask for your GitHub username and password. Use a personal access token instead of your password (GitHub doesn't accept passwords anymore for this). Go to GitHub → Settings → Developer settings → Personal access tokens → Generate new token. Give it repo permissions and use that as your password.
After it uploads, refresh your GitHub page. Your files should be there!
Basic Git Commands You'll Use
Here are the commands you'll use most:
- git status: See what files have changed
- git add .: Stage all changes (prepare them to be committed)
- git commit -m "message": Save a snapshot with a message
- git push: Upload your commits to GitHub
- git pull: Download changes from GitHub
- git log: See your commit history
Making Changes and Updating
When you make changes to your files:
- Edit your files
git add .git commit -m "Describe what you changed"git push
That's the workflow. Make changes, add them, commit them, push them. Do this regularly - don't wait until you have a million changes.
Common Mistakes Beginners Make
- Forgetting to commit: Changes aren't saved to Git until you commit them. Just saving the file isn't enough.
- Not writing good commit messages: "Update" doesn't help. Write something like "Fix login bug" or "Add contact form".
- Committing too much at once: Make smaller, more frequent commits. It's easier to track what changed.
- Forgetting to push: Commits are local until you push. If your computer dies, you lose them.
- Not pulling before pushing: If someone else made changes, pull first, then push.
Pro Tip: Commit often. Every time you finish a small feature or fix a bug, commit it. Small, frequent commits are way better than one huge commit at the end of the day.
Using GitHub's Web Interface
You can do a lot directly on GitHub's website:
- Create files: Click "Add file" → "Create new file"
- Edit files: Click on a file, then the pencil icon
- See history: Click on a file, then "History" to see all changes
- Create branches: Click the branch dropdown, type a name, create branch
For simple changes, the web interface is fine. For bigger projects, use the command line.
What's Next?
Now that you've got the basics:
- Learn about branches (for working on features without breaking your main code)
- Learn about pull requests (for collaborating and reviewing changes)
- Explore GitHub's features - issues, projects, wikis
- Contribute to open source projects
But don't worry about all that yet. Master the basics first - add, commit, push. Once that's second nature, the rest is easier.
Common Questions
Do I need to know programming to use GitHub?
Not really. GitHub works with any files - code, documents, images, whatever. But it's most useful for code projects.
Is GitHub free?
Yes! Free accounts get unlimited public and private repositories. You only pay if you need advanced features for teams.
What's the difference between Git and GitHub?
Git is the software that does version control on your computer. GitHub is the website that hosts your repositories online. You use Git commands to interact with GitHub.
Start Using GitHub Today
Don't wait. Create an account, make a repository, upload something. Even if it's just a "Hello World" program. The sooner you start using it, the more comfortable you'll get. And trust me - once you're used to it, you'll wonder how you lived without it.