No Bitbucket repositories found

Issue #119 resolved
Chris Abernethy created an issue

I have multiple Atlassian accounts for various different clients, and use SSH-key access to connect to each using a unique domain that is handled by my .ssh/config file:

Host bitbucket.org-client_a
  User           git
  Hostname       bitbucket.org
  IdentityFile   ~/.ssh/id_rsa-client_a
  IdentitiesOnly yes

Host bitbucket.org-client_b
  User           git
  Hostname       bitbucket.org
  IdentityFile   ~/.ssh/id_rsa-client_b
  IdentitiesOnly yes

This configuration results in remote URLs that look like this:

$ git remote show origin
* remote origin
  Fetch URL: git@bitbucket.org-client_a:<user_name>/<repo_name>.git
  Push  URL: git@bitbucket.org-client_a:<user_name>/<repo_name>.git
...

Because of these custom domain names that are not really domain names (and certainly aren't bitbucket.org exactly) it seems like the plugin is unable to identify these as Bitbucket repositories.

It would be great if there was some way to accommodate this type of setup, both the custom remote URL format as well as interacting with multiple Atlassian accounts.

Comments (16)

  1. Mihai Stefanescu Account Deactivated

    Same issue for me, it only sees the pull requests from the project I had open when I logged in to Atlassian. When I opened the other projects it did not work, even though they were on the same ssh key

  2. Pramod Busam Account Deactivated

    @Chris Abernethy In version 1.4.0 of the extension, we changed the logic to look for a substring with bitbucket.org instead of exact match to check if a repo is a Bitbucket cloud repo. Can you try it out and let us know how it goes? We still support only one Bitbucket account though, so I’m curious if it works out for you.

    @{557058:3f49594c-3d49-455a-be05-e9fd527ad440} The extension only looks for Bitbucket cloud repos that are open in VS Code. That corresponds to the git repos that you can see in VS Code’s source control view (https://code.visualstudio.com/docs/editor/versioncontrol).

  3. Chris Zwicker

    @pbusam same issue here. could you maybe relax a bit more and look for a substring with bitbucket (without “.org”)? And in general, would it not be better to try and communicate with the configured repo to see whether or not it’s a Bitbucket repo? Alternatively, could we just manually configure Bitbucket repos that are not automatically identified?

  4. John Curtis

    Still not working for me with the substring fix. I’m using a repo name similar to this in .git/config:

    ssh://git@bitbucket.org.myrepo/MyRepo/repo.git

    which is aliased in my .ssh/config and works fine outside of the Atlassian plugin.

    I’m with @chezwicker as you should be able to connect to the repo and tell if it’s Bitbucket or not and go from there. Thanks.

  5. Mihai Stefanescu Account Deactivated

    @{557058:a30b5736-f3cf-41d7-aad0-99c9ffac78ce}

    it does not work for me even in 1.4.0. I can see the git repo in vs code’s source control management, but the Atlassian extension does not show any pull requests.

  6. Pramod Busam Account Deactivated

    @{557058:3f49594c-3d49-455a-be05-e9fd527ad440} Can you check if the output of git remote -v on the command line shows something like git@...bitbucket.org...:<user_name>/<repo_name>.git as the URL? (I am looking for bitbucket.org in the url).

  7. Mihai Stefanescu Account Deactivated

    @{557058:a30b5736-f3cf-41d7-aad0-99c9ffac78ce} it doesn’t, it says git@companyname:repo/reponame.git, because I use 2 ssh keys for personal projects and company projects so I added in the ~/.ssh/config

    Host companyname
      User           git
      HostName bitbucket.org
      IdentityFile ~/.ssh/company
      IdentitiesOnly yes
    

    VScode works ok with git commands though. Does this mean I have to change ssh name to include Bitbucket and update the remote for all my projects?

  8. Pramod Busam Account Deactivated

    That's right. We have access the the git clone urls but we did not find a proper way to get the hostname in ssh alias from the extension. So as a workaround, the extension looks for bitbucket.org in the git clone url.

    Can you try renaming or creating a new alias to include bitbucket.org in the ssh alias Host (eg. Host companyname_bitbucket.org or Host bitbucket.org_companyname) and see if that works?

  9. Chris Zwicker

    May I suggest you change this to just look for bitbucket (no .org)? It’s confusing having TLDs in aliases…

  10. Sandor Agafanoff

    I was experiencing the same issue.
    I added a new host config which included the substring bitbucket.org as the prefix to -companyname and the repository was able to connect.

    The core issue here, is there will never be a way to inspect the ~/.ssh/config from the plugin. Only then, would the plugin be able to find any HostName bitbucket.org entries, and then map that back to the shape of the expected remote url.

    The alternative, is to allow some configuration, where I explicitly tell the plugin which git@companyname:repo/reponame.git companyname aliases are really bitbucket.org hosts. So the plugin can then look for remotes with either bitbucket.org or something out of my provided list of aliases.

    Say I add a .bitbucketconfig file to my which is never checked in…. its just a simple line like

    host_aliases=["companyname1", "comapnyname2"]

    Im all for automatic detection, but you need to help us to help teach you about the way we have things setup sometimes 🙂

  11. Pramod Busam Account Deactivated

    Closing this issue. As we cannot inspect the ssh config from the extension, the workaround mentioned in the issue (rename the ssh alias name to include bitbucket.org and update the remote config or clone the repository again which will use the remote config) is the recommended way to make the extension recognize the repositories as Bitbucket repositories.

  12. Eric Frechette

    I was able to fix this by changing my SSH config host from bitbucket-<company> to <company>.bitbucket.org.

  13. Log in to comment