Reputation: 103
I am working on a repository in my Azure DevOps project, which is forked from some other azure DevOps project. I would like to know source (the original repo from where the forking is done).
Let me know how I can get this information.
Upvotes: 4
Views: 1274
Reputation: 6167
I am not aware that this is exposed in the UI, but there are at least two other ways you can get information about the upstream (parent) repository
A GET
request to https://dev.azure.com/{organization}}/{{project}}/_apis/git/repositories/{{forkname}}?includeParent=true&api-version=6.0
will have a field called parentRepository
in the return message containing the details about the upstream repository
...
"parentRepository": {
"id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"name": "myrepo",
"isFork": false,
"url": "https://dev.azure.com/myorg/_apis/git/repositories/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"remoteUrl": "https://[email protected]/myorg/myproject/_git/myproject",
"sshUrl": "[email protected]:v3/myorg/myproject/myproject",
"project": {
"id": "yyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy",
"name": "myproject",
"url": "https://dev.azure.com/myorg/_apis/projects/zzzzzzzz-zzzz-zzzz-zzzz-zzzzzzzzzzzz",
"state": "unchanged",
"visibility": "unchanged",
"lastUpdateTime": "0001-01-01T00:00:00"
},
"collection": null
}
...
When you are cloning a forked Repo from Azure DevOps Repos the server sends the following message (visible with the standard git command line client)
Cloning into 'myfork'...
Password for 'https://[email protected]':
remote: Azure Repos
remote: This repository is a fork. Learn more at https://aka.ms/whatisafork.
remote: To add its upstream as a remote, run:
remote: git remote add upstream https://[email protected]/myorg/myproject/_git/myrepo
remote:
remote: Found 9 objects to send. (67 ms)
Unpacking objects: 100% (9/9), 1.78 KiB | 6.00 KiB/s, done.
From this message you can find the original repository by looking at the suggested upstream remote:
git remote add upstream https://[email protected]/myorg/myproject/_git/myrepo
In other words, the upstream repo of the fork is called myrepo
and is located in myproject
inside myorganization
.
Upvotes: 4