📝 Git & GitHub

Publishing Your First Repository on GitHub 🚀

0
Author
04e5cc8b-58ac-4bdc-bdee-661bbb
📅
Published
06.05.2026
⏱️
Reading time
3 min
👁️
Views
48
🌱
Level
Beginner

Created a local Git repository and want to share it with the world? Here’s how to publish your project on GitHub!

What Is Publishing?

Publishing means uploading your local repository to GitHub.

Before publishing:
- Code is only on your computer
- No backup
- Can’t share with the team

After publishing:
- Code is on GitHub (in the cloud)
- Accessible from any device
- Can work in a team
- Show it in your portfolio

Method 1: Via GitHub Desktop

Step 1: Create a local repository

If you haven’t done it yet:

  1. FileNew Repository
  2. Fill in:
    - Name: my-awesome-project
    - Description: “My first project”
    - ✅ Initialize with README
  3. Create Repository

Step 2: Make changes

  1. Add files to the project folder
  2. They’ll appear in GitHub Desktop under Changes
  3. Make a commit:
    - Summary: Add project files
    - Commit to main

Step 3: Publish!

  1. Find the Publish repository button (top right)
  2. A settings window opens:

```
Name: my-awesome-project
Description: My first project

☐ Keep this code private

[Cancel] [Publish Repository]
```

  1. Configure the settings:
    - Name — can change it
    - Description — optional
    - Keep this code private — uncheck for a public repository

  2. Click Publish Repository

  3. Wait 10-30 seconds…

Done! Your code is on GitHub!

Verify

  1. Click View on GitHub
  2. A browser will open with your repository
  3. URL will be: github.com/your-username/my-awesome-project

Public vs Private Repository

Public ✅

Pros:
- ✅ Free and unlimited
- ✅ Visible to everyone on the internet
- ✅ Can show to employers
- ✅ Indexed by search engines
- ✅ Can add to portfolio

Cons:
- ❌ Everyone sees your code
- ❌ Can’t store secrets (API keys, passwords)

When to use:
- Learning projects
- Open source
- Portfolio
- Public libraries

Private 🔒

Pros:
- ✅ Only you and invited users can see it
- ✅ Can store private code
- ✅ Free (used to be paid!)

Cons:
- ❌ Not visible in portfolio
- ❌ Requires inviting collaborators

When to use:
- Commercial projects
- Code with secrets
- Unfinished work
- Internal company tools

What Happens During Publishing?

GitHub Desktop:

  1. Creates the repository on GitHub.com
  2. Adds a remote (connection to GitHub):
    bash git remote add origin https://github.com/username/repo.git
  3. Pushes all commits
  4. Pushes all branches
  5. Sets up tracking

After Publishing

Now you have two places where your code lives:

1. Local
- On your computer
- In the project folder

2. Origin (on GitHub)
- On GitHub’s servers
- Accessible from the internet

Syncing

Upload changes (Push):
- Made commits locally
- Click Push origin (↑)
- Commits are sent to GitHub

Download changes (Pull):
- Someone changed code on GitHub
- Click Pull origin (↓)
- Changes are downloaded to you

Check for updates (Fetch):
- Click Fetch origin
- GitHub Desktop checks for new commits
- Nothing changes locally

Common Issues

“Repository name already exists”

You already have a repository with that name!

Fix:
1. Rename the new one: my-project-v2
2. Or delete the old one on GitHub
3. Or use a different account

“Authentication failed”

GitHub Desktop can’t log in to your account.

Fix:
1. FileOptionsAccounts
2. Sign out
3. Sign in again

“Couldn’t publish repository”

Internet problem or GitHub is down.

Fix:
1. Check your internet connection
2. Open github.com in a browser (is it working?)
3. Disable VPN/proxy
4. Try again in a few minutes

Accidentally made it private

No problem! You can change it:

  1. Open the repository on GitHub
  2. Settings
  3. Scroll down → Danger Zone
  4. Change visibilityMake public
  5. Confirm

Security: Don’t Publish Secrets!

NEVER publish:

  • API keys
  • Passwords
  • Tokens
  • Private keys (SSH, SSL)
  • .env files with secrets
  • Database credentials

Solution:

Use .gitignore:

# .gitignore
.env
secrets.json
*.key
config/local.py

These files will NOT go into Git!

Pre-publish Checklist

Before clicking Publish:

  1. ✅ Check .gitignore — no secrets?
  2. ✅ Read README — is it clear what the project does?
  3. ✅ Remove temp files (.DS_Store, Thumbs.db)
  4. ✅ Check the license — added a LICENSE file?
  5. ✅ Make sure the code works

What’s Next?

After publishing:

  1. ✅ Add a description on the GitHub page
  2. ✅ Add topics (tags) for discoverability
  3. ✅ Create a good README.md
  4. ✅ Add a license (LICENSE file)
  5. ✅ Share on social media! 🎉

Your first repository on GitHub is a big step! Congratulations! 🚀

Your reaction to the article

💬 Comments (0)

🔐 Sign in to leave a comment
🚪 Login
💭

No comments yet

Be the first to share your opinion about this article!

🔗 Similar

Similar articles

Continue learning with these materials

📝

Git Hosting Platforms: Full Comparison 🏆

GitHub, GitLab, Bitbucket — which one to choose? A complete comparison with up-to-date data.

📅 06.05.2026 👁️ 52
📝

What Is a Git Commit and Why Do You Need It? 📸

A commit is a saved snapshot of your project at a specific point in time...

📅 06.05.2026 👁️ 56
📝

Why Git won over every other version control syst…

Today Git is the de facto standard for version control in software development. But it...

📅 06.05.2026 👁️ 51

Did you like the article?

Subscribe to our updates and receive new articles first. Grow with PyLand!