If your pipeline is Classic UI pipeline. You can add a script task to download from your private github by running the git commands. See below steps:
Classic Pipeline
1, Create variables username
and password
(change the variable type to secret for password) in Variables tab.
if your password or username contain @ replace it with %40
2, Add a powershell task to run below inline git clone commands:
git config --global advice.detachedHead false
git clone -b mytag --depth 1 https://$(username):$(password)@github.com/mygitaccount/myrepo.git -q
Then your private github repo will be downloaded to the folder $(system.defaultworkingdirectory)/myrepo
.
Yaml Pipeline
If you are using Yaml pipeline. Besides of above workaround of running git commands in script tasks, you can also use repository resources and checkout step.
First, you need to create a github service connection(eg. MyPrivateRepoConnection
in below example) to connect to your private github repo with your azure organization.
Then define repository resources and checkout step in your yaml pipeline. See below example:
resources:
repositories:
- repository: privaterepo
type: github
name: myorg/myrepo
ref: refs/tags/mytag
endpoint: MyPrivateRepoConnection
steps:
- checkout: self #checkout the self source code of this pipeline
- checkout: privaterepo #checkout private repo