Replies: 1 comment
-
Linking a GitHub repository to Azure DevOpsOn the CCF side, I use our instance of Azure DevOps (ADO) for all of my project/task management, including version control for my internal code. It has been really useful for managing and documenting work and thought processes while e.g. doing an analysis, and then linking the R code related to that part of the analysis so it's all in one place. It's helped numerous times when needing to refer back to see what I did (with my notes), and especially useful when you're collaborating in a team environment. There are certain project, however, where I want to still use ADO to document and manage my tasks, but have the remote repository that holds the version-controlled code to be open-source on GitHub. For example, this R package I've been working on lives on our organizational GitHub page, but I manage my work items and track time spent on it within ADO. With integration that's available, we can link ADO to GitHub so that when we push a change to GitHub, for example, it will automatically link it back to the ADO work item I documented the work in. If you look at this commit, for example, ClevelandClinicQHS/riskcalc@752287c, it had This has been really convenient to keep all work tasks managed in a single place, regardless if the code is open-source or not. So I wanted to share how to set up this connection. You may need some sort of administrative privileges in the project and on GitHub, so let me know if it doesn't work. Steps to connectStep 1: Add a GitHub connection to an ADO projectOn the bottom of the page, go to "Project Settings" -> "GitHub Connections" -> "New Connection" then once you add your credentials, you'll see some options of GitHub accounts to connect to. In my case I see this account and my personal one: I choose the ClevelandClinicQHS account. Now that account is associated with the ADO project. Also note that I had to install the Azure Boards app on GitHub from our QHS account to make this connection work. This article (and other related ones) are what helped me get there: https://learn.microsoft.com/en-us/azure/devops/boards/github/install-github-app?view=azure-devops Step 2: Create a GitHub repositoryThe next step would just be to have the GitHub repository you want to link to, created. So I'm going to create a new repository, called The repository is now located here: https://github.com/ClevelandClinicQHS/pubsource Step 3: Link to the GitHub repository from ADOThe final step is to add this new repository to the connection that was created in step 1 in order to tell ADO we want to be to communicate with this remote repository. So back in ADO in the project administration, you'll see that I'm already connected to a couple repositories: I just want to add the new repository to the existing repository, so I'll click the triple dots and "Add repositories": It'll fetch the list of repositories in the connection and I'll choose the one I want: Then once I save, I'll see it listed in the repositories. Linking a commit to the repositoryNow that the connection is made, we can start doing work and linking our commits on GitHub to ADO work items. Make a work itemIn ADO within the Project we established the connection, I made a work item to create this new repository Make a commit and link itNow I just need to make a commit to it. All I did was edit README.md from GitHub. The important part is the commit message. I tagged the commit with If I go back to ADO and look... I see that the commit was linked to the work item. That's it. |
Beta Was this translation helpful? Give feedback.
-
Hey everyone,
We've had a couple people transfer repositories to our page, so figured it would be worth adding some notes about that process here (among other things) in case it is useful to anyone. We can also use this thread for general conversation about repository administration, connection issues, etc.
Creating a repository
When you create a repository in our organization's page, the default (as of now) is that you will have write access and all other members will have read access (see this page for more info). This means that you will be the only person that can actually push/make changes to the repository (except for administrators, who can do anything, but won't!).
I find the easiest way to initialize a new repository is to create it within GitHub itself from the Repositories tab of the main page, and then click "New Repository".
Transferring a repository
When you transfer a repository from your personal account to the organization's page, it is actually removed from your account, and placed under the "ownership" of the organization. However, similar to creating the repository from scratch, the organization's default repository access roles set in such that (as of now) you will be the only one who has write access and all other members have read access (again, except for administrators). The main difference is that you will no longer have access to destructive actions on the repository (like transferring, deleting, etc.), that can only be done by the organization administrators. There are some other things that happen as well which you can read about here.
Here are the steps to make the transfer (first, you must be a member of the organization):
You should now see the repository at
https://github.com/ClevelandClinicQHS/<your repo>
Connecting to the remote repository
I wasn't sure if there would be any issues or additional steps to take in order to push/pull to the repository on GitHub from our CCF machines. Doing it from Terminal, at least, there were no issues (I don't know if other things might happen if you try to do from RStudio, for example), but here is what I did to create this test commit from my CCF machine (which is Windows):
git clone https://github.com/ClevelandClinicQHS/.github.git
cd
, then stage, commit, and push changespush
generated from authentication steps that first needed to happen.I was prompted with:
And chose the "Sign in with a code" option, which then displayed a code to use for authentication. I logged into https://github.com/ and was prompted to type in the code. Once that went through, the
push
finished and the changes I made were observable on the GitHub repository.Beta Was this translation helpful? Give feedback.
All reactions