Accessing Bitbucket Private Repo
Fixing Git-related problems
2 min read
The Backstory 🥲
So I'd been making code changes on a server I had access to for a while now. And wanted to push the changes to Bitbucket, so I could work with the update locally. So I run
git add . git commit -m "whatever suit me" git push origin main
But to my surprise, I receive an error in return.
I wasn't expecting that, since I had Admin rights to the repo and had earlier added the server's SSH key to the Bitbucket repo. How did I manage to do that? Simple; I followed the instruction I found on Bitbucket Support. But since it wasn't my first rodeo, I just skipped the long talk and copied the codes instead.
What I did 😎
eval $(ssh-agent) ssh-add ~/.ssh/id_rsa.pub ssh -T firstname.lastname@example.org
And voila, no errors.
Not having shell access isn't a problem, after all. How do I know? Well, some random dude said that.
What then was the issue? 🙈
So, it turned out that I added the generated public SSH key to the "Repository settings" of that repo, instead of my Account's "personal settings" as the Support instructions mentioned.
Yes, it was there; however tiny it was. But seriously right, these guys should put a warning sign next time.
What's the fix, bruv 😒?
The solution was to add that public SSH key to my account, but not before deleting it from the Repo settings.
What happens when you don't delete it first? This 👆🏼
Did that. And boom, it worked!
So, there you have it guys. Till next time, happy coding!