GitHub private repositories owned by an Organization not showing

In our Github account, User X is an Owner in Organization Y.

Organization Y owns multiple private repositories. From Organization Y's profile, I added JIRA as an application which generated a Client ID and Client Secret. I then put these values into JIRA DVCS plugin while creating a new DVCS account. I used User X as the authorizing account. The DVCS account was added, but I am not seeing the private repositories under Organization Y within it. Can you please help.

I am using JIRA 5.2.4.1

JIRA DVCS Connector Plugin version 1.4.2.10


2 answers

1 accepted

Hi Aneralla,

Here is a report from a user experiencing the same issue:

I've been having the exact same issue all week but think I've figured out a workaround. Jira is expecting either a valid user or team name, however what you want to provide is the organization name. In order to get JIRA to work with an organization you need to trick it into thinking it's authentication against a user, then modifying the OAuth return url so it uses the organization rather than the user for the return callback.

As a note, I'm running the downloaded version of JIRA rather than OnDemand.

1) Create an application in Github under that organization (or revolk the application for that user)

2) In Jira, provide a user rather than a team or organization name

3) When you get to Github to authorize the OAuth request modify the url segment that looks like "organization%3Dyour-account-name" to look like "organization%3DYour-OrganizationName", and load that page.

4) Authorize the OAuth request on Githuhb

5) When you get redirected back to JIRA, you'll most likely see the error: "Error obtaining access token: Bad verification code". Ignore it, and click on the "DCVS Accounts" link under Source Control under the left hand panel.

6) You should see all your public and private repositories for that organization now. When I loaded it up I saw a bunch of MySQL errors, but I refreshed the list they all went away and all the private repositories for my organization were there.

The full thread can be found here: https://jira.atlassian.com/browse/DCON-324 and please note that this method has been successful for several users!


Thanks

Turner

Thanks a ton, Turner. This worked for me...I really appreciate your help!

This helped us get things working !! Thanks very much !

how is everybody raving about this? This issue is 2 years old and still there is no proper support for private repos of organizations in JIRA...

I totally agree, we had the same issue with JIRA in the Cloud and this workaround still needs to be done in October 2015!!

Checking in from 2017. Surprisingly, and thankfully, this is still the correct answer! Thanks Turner!

Before you can add a JIRA -> GitHub link you must pick one admin user from JIRA and one admin user from GitHub.  They don't necessarily have to be the same user, but it is best practice if both systems have a user to represent the ones being used.

 

On GitHub:

Before you begin, you will need to have a github account with admin/owner privileges of the organization.   You will also need to know the URL of your JIRA system.

By default, when you create an application api key, it is associated with your individual user.  Not the organization.  So you need to have an admin github user create an organization owned api key.  It takes some effort to find where these settings are. 

We will assume that your organization is called "myorg" and you would get to your organization repos by going to: https://github.com/myorg

Then you can find the organization owned apps from here:  https://github.com/organizations/myorg/settings/applications

If you set up the app tokens via: https://github.com/settings/applications , it won't work because this is where you would setup your personal app tokens (even if you are a github administrator for your organization repos).

The bizarre thing is that once everything is configured properly (both github and jira), it will shoow up under your personal apps as an "approved app".  The way I discovered this was by putting "(Organization:myorg)" in the title of the organization app and "(User:myuser)" in the user app.  This allowed me to differentiate which app tokens was going where.

When you create your organization's api application the, the Homepage URL and Authorization callback URL should be the same as your JIRA system url (i.e.  https://myjirasite.atlassian.net).  

  • AppName:  <whatever you want>
  • Homepage Url:  https://myjirasite.atlassian.net 
  • App description:  <whatever you want>
  • Authorization callback Url: https://myjirasite.atlassian.net/ 

Once you have github setup correctly, you will need to remember the OrganizationName, ClientID and ClientSecret.  They are needed to create the DCVS link in JIRA.

 

On JIRA DVCS:

You will have to login as an administrator in your JIRA system.  Go to your Settings->Applications->DVCS_accounts.  Click on the "Link Bitbucket Cloud or GitHub account" button:

  • Host: GitHub
  • Team or User Account:  myorg
    • NOTE: You use your organization's name here.
    • What is interesting, is that this field maps out to "https://github.com/<input>".  
      • If you enter "myuser", it will show you the repos of "https://github.com/myusr"
      • If you enter "myorg", it will show you the repos of "https://github.com/myorg".
  • Client ID:  This should be your organization's owner app client ID.
  • Client Secret: This should be your organization's owner app client secret.
  • AutoLink new repos:  Checked
  • Enable smart commits:  Checked

Assuming that your information is valid, it will forward you to an OAuth approval webpage.  You want to make sure that you select "allow public and private access" to the repos.  And you want to log in as a github administrator to allow the access.

Once access is approved, you should take you back to your JIRA DVCS page.  This is where you should see your repos listed and starting to sync.

Hope this helps,

-Randy

 

I found these links useful:  

 

This was super useful !I wasted a couple of hours trying to figure out why I was not able to see my organization repos ! Thanks !

Thanks a lot in advance.

Question about security/isolation, say in organization X there is a private repo Y and a private repo Z. Say, repo Y has clients C in it but repo Z is completely organization X's and we do not want client C to have any knowledge that this exist . So on github we are able to do this with groups, does this stay the case in JIRA if we go down this path?

Hi John, were you ever able to identify how to only grant access to one repository in GitHub? We're facing a similar issue. We're working with an outside firm that has many repos in their organization and we're trying to figure out how they can grant access to our Jira Server for just our repo. The standard method seems to be the whole organization's repos or nothing and they obviously cannot allow that for the security of their other repos/clients.

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Bridget Sauer
Published Thursday in Marketplace Apps

Calling all developers––You're invited to Atlas Camp 2018

 Atlas Camp   is our developer event which will take place in Barcelona, Spain  from the 6th -7th of   September . This is a great opportunity to meet other developers and get n...

77 views 0 5
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you