Sunday 23 December 2018

ssh - How can you avoid being asked to enter your BitBucket password when you push to BitBucket wiki?


I'm not sure if everyone experiences this - when I edit a BitBucket wiki locally (through a git repository) I have to enter my BitBucket password for every pull and push.


Is there any way around this?


I have ssh correctly configured to use a key that is unlocked by gnome-keyring. Pushing to the code repository for my project in BitBucket works fine - I do not need to enter either by BitBucket or ssh key password.



Answer



The problem is that, when you clone the wiki's repository, the clone is done through HTTPS, since the link provided by Bitbucket uses HTTPS to access the repository. What you need is a way to access using SSH as the protocol, instead of HTTPS.


It is actually possible to access the wiki's Git repository through SSH, although Bitbucket does not provide the link to do that.


Thanks to a ticket on Bitbucket's issue tracking system, I found that you can access the wiki repository through SSH by using the same URI of the project's repository, but with /wiki appended.


So, if your project's repository is under git@bitbucket.org:UserName/project-name.git, the wiki repository can be accessed at git@bitbucket.org:UserName/project-name.git/wiki, instead of using the HTTPS URI provided by Bitbucket.


This way, you can clone your wiki by running the command


git clone git@bitbucket.org:UserName/project-name.git/wiki

or, if you have already cloned the wiki repository using HTTPS, you can change the origin remote to use SSH by running the command


git remote set-url origin git@bitbucket.org:UserName/project-name.git/wiki

I have already tried this, and it works perfectly! You will not be prompted for your password anymore, since Git is now using SSH with your SSH key to log into the server.


No comments:

Post a Comment

Where does Skype save my contact's avatars in Linux?

I'm using Skype on Linux. Where can I find images cached by skype of my contact's avatars? Answer I wanted to get those Skype avat...