The Ultimate Guide: Setting Up GitHub on Your MacBook and Uploading Your First Project, How to Setup GitHub and Upload Your First Project on a MacBook: A Step-by-Step Guide || GitHub Mac Setup

So, you’ve finished your project on your Mac, and now it’s time to share it with the world (or just back it up safely). Moving from local code to a GitHub repository is a rite of passage for every developer.

In this guide, I’ll walk you through the exact Terminal commands to get your code live, including the secret to bypassing the “Invalid Username or Password” error that trips everyone up.

Step 1: Create Your Repository on GitHub

Before touching your Mac’s Terminal, you need a place for your code to live online.

  1. Log in to GitHub.
  2. Click the + icon (top right) and select New repository.
  3. Name your project (e.g., imagetopdfconverter).
  4. Set it to Public or Private.
  5. Important: Leave “Initialize this repository with…” options unchecked. We want a clean slate.
  6. Click Create repository and copy the URL provided (it ends in .git).
<img fetchpriority=

Step 2: The Mac Terminal Magic

Open your Terminal (Cmd + Space, then type “Terminal”). We are going to “Gitify” your project folder.

1. Navigate to your project

Use the cd (change directory) command. You can type cd and then drag your folder from Finder into the terminal window.

Bash

cd /Users/yourname/Documents/YourProjectFolder

2. Initialize Git

This creates a hidden .git folder that tracks your changes.

Bash

git init

3. Stage your files

This tells Git, “Hey, I want to include all these files in my next snapshot.”

Bash

git add .

4. Create your first Commit

This saves your snapshot locally with a descriptive message.

Bash

git commit -m "Initial commit: Flutter project ready"

5. Rename your branch to Main

GitHub uses main as the default branch name. Let’s make sure your Mac is on the same page.

Bash

git branch -M main

Step 3: Connecting Mac to GitHub

Now, we link your local folder to the remote repository you created in Step 1.

1. Add the Remote Origin

Paste the URL you copied earlier here:

Bash

git remote add origin https://github.com/yourusername/your-repo-name.git

2. The Final Push

Now, try to upload your code:

Bash

git push -u origin main

Step 4: The “Password” Gotcha (Personal Access Tokens)

If you get an Authentication Failed error, don’t panic! GitHub no longer accepts your account password in the Terminal. You need a Personal Access Token (PAT).

How to get one:

  1. On GitHub, go to Settings > Developer Settings > Personal Access Tokens > Tokens (classic).
  2. Generate a new token and check the ‘repo’ box.
  3. Copy that token immediately.
  4. When the Terminal asks for your “Password,” paste the token instead of your GitHub password.

Conclusion

And that’s it! Your code is now safely stored on GitHub. By using the Terminal on your Mac, you have more control over your version history and are one step closer to a professional dev workflow.

Happy Coding!

SEO Tips for your Post:

  • Images: Add screenshots of the GitHub “New Repository” page and the “Developer Settings” for the token.
  • Alt Text: Label your images as “GitHub Mac Terminal setup” or “GitHub Personal Access Token scopes.”
  • Internal Links: If you write a post about Flutter later, link back to this guide!

Related Articles

Categories: FLUTTERGitHub

Deepika

Hey, I'm Deepika, Experienced in Mobile app Development (Flutter, Android and iOS) and professional blogger. Technically sound Post graduated M.Tech in Computer Science and Engineering. I Love to gain every type of knowledge that's why i have done many courses in different fields like engineering and technology. Skilled in Flutter,( Dart ), Java, HTML, CSS, PHP, Python, SQL, C, C++,Firebase,MySQL,SQLite,JavaScript, Networking, Ethical Hacking.

0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *