Rod
Rod

Reputation: 15433

Is there a way to link GitHub repo to Azure Project?

I have some code in my GitHub repo. I figured out how to build it through my Azure Pipeline.

Is there a way to link the code as well? I don't know if that necessarily makes sense. I see the option to import a repository and that works for me.

Just curious if there is a way to review a live version of the github code in Azure. Or how are people using Azure DevOps when they have GitHub repository?

Upvotes: 1

Views: 1613

Answers (2)

Hugh Lin
Hugh Lin

Reputation: 19371

If you want to synchronize the github repo code to the azure devops repo, you can do it through the following steps.

For a single branch,push update from github repo to azure devops repo,see below command:

git clone https://github.com/XXX/XXX.git
git config --global user.name "XXX"
git checkout master
git add .
git commit -m "abc"
git push https://{AzureDevopsPAT}@dev.azure.com/{org}/{pro}/_git/delete.git

enter image description here

To loop through all branch in github, use the following command:

git branch -r | grep -v '\->' | while read remote; do git branch --track "${remote#origin/}" "$remote"; done
git push https://$(VSTSToken)@dev.azure.com/xxx/_git/xxx -u --all

In order to kick the build every time there is a code change we need to go to trigger tab and setup like this:

enter image description here

For details ,please refer to this ticket.

Upvotes: 1

user14239181
user14239181

Reputation:

Azure DevOps supports several source code repo including GitHub. You can use your existing Github repo while creating pipeline. Following screen shot from the Azure DevOps console. This is the 1st step while creating a pipeline where you can connect to your existing repo.

enter image description here

Upvotes: 3

Related Questions