Unable to git push to my own repo #171965
Why are you starting this discussion?Question What GitHub Actions topic or product is this about?Misc Discussion DetailsI am not able to push to my own repo after committing changes. I tried doing the 'git remote -v' and it is showing the correct repo after that I tried running the commands for PAT token and still got some errors: |
Replies: 3 comments 14 replies
|
The error happens because GitHub removed password authentication for Git pushes. You need to use a Personal Access Token (PAT) instead of your GitHub password. Here are the steps:
git remote set-url origin https://<USERNAME>@github.com/<USERNAME>/<REPO>.gitI hope it helps 🙏 |
|
HI, @AthArvA-188 Root cause
Fix (pick one) A) HTTPS with a Personal Access Token (PAT)
Fast path: gh auth login # HTTPS → "Login with a web browser"
gh auth setup-git
git pushB) SSH (no tokens) ssh-keygen -t ed25519 -C "you@example.com"
eval "$(ssh-agent -s)"; ssh-add ~/.ssh/id_ed25519
# Add ~/.ssh/id_ed25519.pub to GitHub → Settings → SSH and GPG keys
ssh -T git@github.com
git remote set-url origin git@github.com:OWNER/REPO.git
git pushIf it still fails
|
|
Hey, GitHub stopped using passwords for Git. You need a Personal Access Token (PAT) to push. Generate a PAT on GitHub with repo access. Update your remote: git remote set-url origin https://:@github.com//.git Push again. Or use SSH to avoid the token |
The reason you weren’t asked for username/PAT is that Git Credential Manager (GCM) stepped in, found valid credentials (either cached from earlier or picked up automatically from GitHub CLI/Windows Credential Manager), and used them silently.
That’s exactly what it’s supposed to do.