Tuesday, October 28, 2025

Push your local project to your own GitHub account


Step 1 — Check current remote

Run this in your project folder:

git remote -v

You’ll probably see something like:

origin  https://github.com/username/reponame (fetch)
origin  https://github.com/username/reponame (push)

 Step 2 — Set the correct remote for the username
git remote set-url origin https://github.com/username/reponame.git
 
 Step 3 — Verify the change

Run again:

git remote -v

You should see:

origin  https://github.com/username/reponame (fetch)
origin  https://github.com/username/reponame (push)
Step 4 — Set your identity (you already did this, but just to confirm)
git config user.name "username"
git config user.email "email@gmail.com"

Step 5 — Push to GitHub

Now push the main branch:

git push -u origin main

If prompted for credentials:

  • Username:

  • Password: your GitHub Personal Access Token (PAT) (not your GitHub password)

👉 Create one here: https://github.com/settings/tokens

When creating the token:

  • Choose “Fine-grained personal access token”

  • Grant Repository → Read and write access

  • Copy and paste it when Git asks for your password.


No comments:

Post a Comment