Remove a git fork relationship in Azure Devops (VSTS)
Asked Answered
L

4

18

I created a Azure Devops (VSTS) project by forking another project. Now whenever we clone the new project you get references to the original project in the console output

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 <link to original repo>

Is there any way to break this linkage so the new project never references the old one?

Laywoman answered 4/6, 2018 at 4:49 Comment(0)
C
18

If you don't want anymore to have a fork, you could try:

  • clone that fork
  • delete the VSTS forked repo
  • create a new empty one
  • change the remote URL of your local clone

    git remote set-url origin /URL/new/VSTS/repo
    
  • push everything

    git push --mirror
    
Careful answered 4/6, 2018 at 5:13 Comment(2)
Hey, thanks. I figured this method, but am trying to figure out if there is a way to do it without having to delete and/or creating a new project/repo in VSTS (permissions/red-tape problems). There's got to be something within git that lets you do this, no?Laywoman
@JeevanJose you are using Git locally. All that Git knows is where to push. The message you see if the answer of the remote hosting server, and your local Git has no control over it.Careful
G
1

Just using Azure DevOps UI I have done the following:

  • Import your fork as a new repository (which will not be a fork).

    enter image description here

  • Rename the fork (to some kind of archival name, just in case you want to keep access to the PRs generated, or delete it).

    enter image description here

  • Rename the imported repository to the regular name.

Then you keep the branches, commits and everything as if you would do a mirror using the Git CLI.

Gadolinite answered 22/8, 2022 at 12:2 Comment(0)
D
1

Go to project settings, then repositories, find your fork and delete it via UI enter image description here

enter image description here

Denisdenise answered 8/1 at 14:1 Comment(0)
H
0

You can create a new branch from your master. Then make it the default branch. Delete you main and now the pulls will not automatically go back to the upstream.

Hombre answered 16/4, 2021 at 21:35 Comment(2)
Welcome to SO! Could you include code snippets / an example along with this explanation?Sheetfed
This solved one annoyance, but keep note of this notice from DevOps documentation: "You can't search code in forked repositories." ...which might be something you wish to do at times, so really want a way to break the fork relationship in devops rather than just for the PR problem.Comparison

© 2022 - 2024 — McMap. All rights reserved.