Mr. Robot

Mr. Robot

Accessing Bitbucket Private Repo

Accessing Bitbucket Private Repo

Fixing Git-related problems

Ridwan Olanrewaju's photo
Ridwan Olanrewaju
ยทFeb 16, 2022ยท

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.

Screenshot 2022-02-16 at 11.12.21.jpeg

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 git@bitbucket.org

And voila, no errors.

Screenshot 2022-02-16 at 11.36.04.jpeg

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? ๐Ÿ™ˆ

Screenshot 2022-02-16 at 11.59.43.png

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.

Screenshot 2022-02-16 at 12.10.02.png

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 ๐Ÿ˜’?

Screenshot 2022-02-16 at 13.43.08.png

The solution was to add that public SSH key to my account, but not before deleting it from the Repo settings.

Screenshot 2022-02-16 at 11.03.50.jpeg

What happens when you don't delete it first? This ๐Ÿ‘†๐Ÿผ

Screenshot 2022-02-16 at 11.09.02.jpeg

Did that. And boom, it worked!

So, there you have it guys. Till next time, happy coding!

ย 
Share this