How to use existing putty generated ssh key in PyCharm (Windows)


1. Open puttygen.exe (It is often bundled with many git client, e.g. GitExtension. download it here if there isn’t.)

2. Choose “Conversions” -> “Export OpenSSH key“, export it to the home_directory\.ssh\ folder as file “id_rsa”.

3. Do git operations (e.g. commit, push) in PyCharm.

* Note 1: Step 2 will overwrite existing id_rsa, so this approach only applies to single ssh key. If we need to use multiple ssh key, other method is needed (e.g. using .ssh/config file)
* Note 2: I didn’t test the case in which private key is protected using this approach.


Chrome extension development – After extension button is clicked

Concepts mentioned

* mainefest file
* browser action

Two cases

When extension button is clicked, two cases exist, depending on whether the “default_popup” option in manifest file is set or not.

case 1: “default_popup” option is set

If “default_popup” is pointed to a html file(e.g. popup.html), then this will be opened when button is clicked.

case 2: “default_popup” option is not set

If not set, then the behavior will depend on the callback we set using function “chrome.browserAction.onClicked.addListener()“.

For example, we can put “chrome.browserAction.onClicked.addListener()” in our background page/script , then in the callback we can do a variety of things we want using the chrome.* api including:
* access tabs opened currently using “chrome.tabs.getAllInWindow()” api;
* open some url in specified tab using “chrome.tabs.create()” api;
* store something in local storage using “*” apis;

Note, the callback we set above will not be called if “default_popup” is pointed to a page either by editing manifest file or programmatically(which we’ll cover below).

Toggling the option in runtime

disable the popup (case 1 => case 2)

Just call chrome.browserAction.setPopup({popup: “”}) .This could be placed in the popup page(e.g. call it when user click a button in the popup). After this is set, the listener callback we set before is available which will be called when on user click event.

enable the popup (case 2 => case 1)

Just call chrome.browserAction.setPopup({popup: “somepage.html”}) .This could be placed in some custom pages. After this is set, the listener callback we set before will never be called as the behavior is overrided by popup page rendering.

Group projects in Bitbucket

I used to store small projects in private using Bitbucket. Recently I come to check whether repositories can be grouped in a container like thing, finally I found that currently the only way is to create a “project” in Bitbucket and put repo under that project, below are the steps:

1. Create a team. A project can only be created by a team. In top navigation bar, click “Teams” -> “Create team“. Note that the creator is automatically added to the team granting the role “Administrator”. (ps: considering the ownership there’re two kinds of repo: individual repo and team repo and we will see them in step 3)

2. Create a project. In top navigation bar, click “Projects” -> “Create project“. As we can see, only team can be owners here.

Note: I will discussing three cases in the third step.

3a. Create new repo in the project. On the left sidebar under the project page, click “” -> “Create repository“. Then a new project repo(team repo) can be created. For example the id of the team we create is “devteam“, the project id is “demo“, and the repo id is “imserver“, then the git url of the repo will be

3b. Add existing individual repo to the project. On the left sidebar under the project page, click “” -> “Add repositories“, and then in the next page click “Add repositories from an individual account” at the top right. The url of the original repo may change during the process so we may need to update local git config afterwards. For example we add the repo “imclient” of the current user “bob” to the project “imclient” of team “devteam”, then the git url of the repo will be changed from to

3c. Add existing team repo to the project. On the left sidebar under the project page, click “” -> “Add repositories“, then choose repo from the list below. There will be no url change in this case as the owner didn’t change, we only move repo from one project to another.(It seems that a team project can only belongs to one project at any moment)

Note: There’re no copy operation of repo in step 3b and 3c.