Перейти к содержимому

Как удалить forked репозиторий

  • автор:

Deleting a repository

You can delete any repository or fork if you’re either an organization owner or have admin permissions for the repository or fork. Deleting a forked repository does not delete the upstream repository.

Only members with owner privileges for an organization or admin privileges for a repository can delete an organization repository. If Allow members to delete or transfer repositories for this organization has been disabled, only organization owners can delete organization repositories. For more information, see «Repository roles for an organization.»

Deleting a public repository will not delete any forks of the repository.

Warnings:

  • Deleting a repository will permanently delete release attachments and team permissions. This action cannot be undone.
  • Deleting a private repository will delete all forks of the repository.

Some deleted repositories can be restored within 90 days of deletion. For more information, see «Restoring a deleted repository.»

On GitHub.com, navigate to the main page of the repository.

Under your repository name, click

Settings. If you cannot see the «Settings» tab, select the

dropdown menu, then click Settings.

Screenshot of a repository header showing the tabs. The "Settings" tab is highlighted by a dark orange outline.

Under Danger Zone, click Delete this repository.

Repository deletion button

Read the warnings.

To verify that you’re deleting the correct repository, type the name of the repository you want to delete.

Deletion labeling

Click I understand the consequences, delete this repository.

Help us make these docs great!

All GitHub docs are open source. See something that's wrong or unclear? Submit a pull request.

How to unfork a GitHub repository (2023 official method)

Who doesn’t love GitHub? And who hasn’t their GitHub account cluttered with forked repositories of projects you’ve long stopped contributing too? Do you want to clean up your account and unfork outdated repositories? Learn how to unfork a GitHub repo the correct way.

How to unfork a repository

Unfortunately, GitHub doesn’t offer an Unfork repository button. Unforking is a manual process which needs to be done by a GitHub employee. But because of the large demand for unforking or detaching repositories, GitHub has built a special chatbot to enter your request. Luckily, the GitHub team performs unfork requests very fast, so it’s very likely that it takes only a few minutes to half an hour.

How to detach/extract a GitHub repository

Go to support.github.com/request (or go to GitHub.com and click Contact GitHub in the footer).

Click Attach, detach or reroute forks.

In the Subject field, typ ‘Unfork’. A blue banner should appear with ‘Our virtual assistant can help’. Click the banner.

A chat should appear on screen with the Virtual Assistant. Paste the URL of the repository.
_Note: make sure to paste the URL to the forked repository, so not the original repository. It should look like github.com/username/forked-repo-name.

Specify what should be done with Child forks:

If username/forked-repo-name has child forks, what should we do with these?
Commonly you’ll want to bring the child forks along with you when detaching your fork from the upstream repository.

  1. Bring the child forks with the repository
  2. Leave the child forks behind

Select one of the options and send the form.

Within a few minutes to half an hour you should get a confirmation in your e-mail.

Now you’ve successfully unforked a GitHub repository! The repository stays in your account as a personal repository, without ties to the original repository.

Using the GitHub visual assistant to unfork a repository.

Using the GitHub virtual assistant to unfork a GitHub repo.

The GitHub assistant to unfork a repository.

What is GitHub forking?

GitHub is a great tool for developing software. Millions of developers and companies build, ship and maintain their software on GitHub. If you’ve used GitHub for a while, you may find yourself wanting to contribute to someone else’s project. Or you would like to use an other project as a starting point for your own project. GitHub makes this really easy by allowing you to fork other people’s projects. But what about unforking?

If your project is finished or if you’ve made your contribution, the forked repository will still be shown in your account as ‘forked from X’.

Published by Ralph J. Smit on 02 February 2021 in Github. Last updated on 22 February 2023.

Что такое Git Fork?

Сегодня мы узнаем, как скопировать чужой репозиторий в наш аккаунт (разветвление в Git с помощью Git Fork), чтобы внести изменения или использовать хранилище для наших собственных целей.

Что такое Git Fork?

Fork — это копия репозитория. Раздвоение репозитория позволяет свободно экспериментировать с изменениями, не затрагивая исходный проект.

Разветвление в GitHub — это процесс создания копии полного репозитория для учетной записи пользователя на GitHub из другой учетной записи. Когда пользователь разветвляет репозиторий, все файлы в нем автоматически копируются в учетную запись пользователя на GitHub, и это выглядит как собственный репозиторий пользователя. Этот процесс похож на копирование папки с одного диска на другой диск компьютера. Затем пользователь может свободно использовать этот репозиторий либо для своих целей, либо экспериментировать с изменениями в коде. С помощью разветвления git пользователи могут разрабатывать свои собственные модификации кода, который принадлежит кому-то другому.

Следует отметить, что этот процесс не оказывает никакого влияния на исходный код репозитория (также называемый восходящим репозиторием).

Fork-Repository

Раздвоение Git через GitHub — это процесс, который изолирован от GitHub. Это означает, что всякий раз, когда происходит fork git, репозиторий и код остаются ограниченными учетной записью пользователя на GitHub. Нет никакого влияния на локальную машину пользователя или участие Git в этом процессе.

Зачем развлетвлять репозиторий на GitHub?

Разветвление репозитория GitHub предоставляет пользователю копию вышестоящего репозитория для его учетной записи. Но зачем нам понадобилось раскошеливаться на репозиторий, разработанный кем-то другим? Ответ на этот вопрос содержится в самой концепции GitHub. GitHub был разработан, чтобы обеспечить платформу для всех разработчиков по всему миру, чтобы они могли внести свой вклад в проект друг друга и сделать лучшее, более надежное программное обеспечение. Очевидно, что никто не захочет видеть сотни изменений без их согласия в исходном репозитории. Таким образом, возникает понятие копии хранилища или раздвоенного хранилища.

Разветвление репозитория на GitHub выполняется для двух основных целей:

  • Улучшение чьего-то кода/программного обеспечения: улучшение чьего-то кода не обязательно означает исправление ошибок и улучшение времени выполнения. Улучшение может заключаться в добавлении новой функции в существующее программное обеспечение / репозиторий.
  • Повторное использование кода в проекте: пользователь может также использовать вилку, чтобы использовать репозиторий другого пользователя в собственном проекте. Идея здесь — “зачем изобретать велосипед”. Популярность Git также объясняется тем, что люди добавляют свой код, проект, модуль, программное обеспечение и т. д. на GitHub в качестве публичного репозитория. Теперь другим людям разрешено использовать этот открытый исходный код в своем проекте, что помогает им экономить свои усилия и время.

Примечание: разветвление разрешено для публичных репозиториев без разрешения. Но если хранилище является частным, то «форкнуть» его можно только с разрешения владельца хранилища.

Git Fork-это простой процесс в GitHub, и он не требует использования какой-либо команды git. Процесс Git Fork выполняется следующим образом:

  • Fork A Repository: пользователь создает копию репозитория для своей учетной записи на GitHub, шаги для этого описаны в следующем разделе.
  • Изменения кода: это включает в себя клонирование git. Пользователь вносит изменения и отодвигает их обратно в свой собственный раздвоенный репозиторий.
  • Отправка изменений в исходный репозиторий: этот процесс называется Pull-запросом в Git. На этом этапе пользователь отправляет изменения владельцу репозитория в виде запроса. Теперь это зависит от владельца, чтобы принять изменения или отклонить. Pull request — это запрос к владельцу вышестоящего репозитория для принятия изменений пользователя.

Пришло время посмотреть, как это сделать.

Как создать ветку репозитория на GitHub?

Чтобы создать ветку одного из репозиториев на GitHub для практики, войдите в свою учетную запись.

Найдем имя учетной записи — harishrajora, а имя репозитория-ToolsQA. Вы можете использовать любой из следующих параметров или оба из них для поиска репозитория.

Если вы используете имя в качестве параметра, введите его в строке поиска. Нажмите All GitHub после ввода имени, чтобы выполнить поиск везде в GitHub.

search_by_name_github

Появится сообщение о том, что репозитория с таким именем нет.

no_repo_find

Это происходит потому, что если вы посмотрите на левую колонку страницы, то по умолчанию в ней будут выбраны репозитории. Поскольку никакого хранилища с именем harishrajora не существует, оно показало это сообщение. Мы знаем, что harishrajora-это имя пользователя, поэтому выберите пользователей в списке.

Select_Users_Search_GitHub

Если вы используете имя+репозиторий в качестве параметра поиска, то введите в строке поиска следующее и нажмите All GitHub.

search_by_name_repo

Продолжая поиск по имени пользователя, который мы сделали сначала, как только вы выберете пользователя, откроется его профиль. В профиле будут показаны популярные репозитории. Выберите ToolsQA среди репозиториев.

ToolsQA_select_repo

Нажатие ToolsQA откроет страницу репозитория. Вы также можете пропустить все вышеперечисленные шаги и перейти на страницу репозитория непосредственно по этой ссылке. Но, лучше знать, как ориентироваться.

Нажмите кнопку Fork, чтобы начать процесс раздвоения git.

fork_a_repo

Репозиторий ToolsQA будет разветвлен на ваш аккаунт мгновенно. Это можно увидеть по вашему имени пользователя после разветвления репозитория.

forked_repo

Теперь, когда у вас есть копия репозитория с помощью Git fork, вы можете изменить и улучшить код в соответствии с вашими потребностями. Также будут случаи, когда вы захотите удалить раздвоенный репозиторий.

Как Удалить Раздвоенный Репозиторий?

Пользователь может удалить раздвоенный репозиторий по любой причине. К счастью, это очень простой процесс. Просто имейте в виду, что не следует удалять репозиторий до тех пор, пока изменения не будут объединены в исходный репозиторий или пользователь не будет слишком уверен в удалении репозитория, так как после удаления вы потеряете все изменения.

Давайте удалим тот же самый репозиторий, который мы разветвляли выше. Для этого перейдите на страницу репозитория (ToolsQA), с которой мы разошлись в последнем разделе. Вы можете перейти на страницу репозитория из списка, расположенного в левом столбце панели мониторинга.

repository_Section

Settings_Repository

На странице репозитория перейдите в раздел Настройки, расположенный в верхней строке.

delete_this_repository

На странице настроек прокрутите вниз до нижней части страницы, и появится раздел под названием Опасная зона.

Нажмите Удалить этот репозиторий в этом разделе, как показано на рисунке выше.

На экране появится отказ от ответственности с просьбой переписать имя репозитория. Напишите имя репозитория, как показано на рисунке, и нажмите кнопку I understand the consequences, delete this repository button.

disclaimer_del_repo

Это приведет к успешному удалению репозитория.

repository_deleted

git pull

В последнем уроке мы познакомились с командой Git fetch и Read more

Git Fetch и Git Merge

В одной из последних статей мы узнали о команде Git Read more

Мы уже знаем, как вносить изменения в локальное хранилище и Read more

Git Push

Команда git push при выполнении перемещает изменения, внесенные пользователем на Read more

Что такое git Clone и как клонировать репозиторий?

«Клонирование» означает создание идентичных особей естественным или искусственным путем. Клонирование Read more

Подключение локального репозитория к удаленному репозиторию GitHub

Все данные, доступные в локальном репозитории, могут быть загружены в Read more

Cleaning up forked GitHub repositories with

One great thing about using GitHub is the ability to view and contribute to others’ code. Even the code underlying many of our favourite packages is available for us to examine and play around with.

Forking a repository is a great way to create an exact replica of someone else’s project in our own user space. We can then freely make changes to this copy without affecting the original project. If you end up especially proud of your changes, you can then submit a Pull Request to offer them up to the owner of the original repository. However, your fork doesn’t have to end up in a contribution — you can also just keep experimenting with the code forever or use it as a starting point for your own project.

A forking mess

If you are an avid forker of GitHub repos, your original repositories on GitHub may quickly become crammed in between an endless stream of forked repos. Your user space has become very cluttered, with old forks that you haven’t looked at in years still taking up space. Well, now it’s time for some spring cleaning and the first task is de-cluttering your repositories by removing forks.

Do you use Professional Posit Products? If so, checkout out our managed Posit services

Manually cleaning

You can manually delete repositories using the GitHub interface. Go to the repository you wish to delete, then select Settings at the top of the page

The Settings button on your repository

Then scroll to the bottom of the page and enter the Danger Zone marked by a red box.

Deleting a repo from the Danger Zone

From there, you can select Delete this repository which will prompt you to confirm that you are absolutely sure of what you’re doing by typing out the name of the repository. Note that after deleting the repository, the action cannot be undone. Also note that if you are deleting a forked repository, deleting it will only remove it (including any changes you have made to it) from your own GitHub — you won’t accidentally delete the original project (phew).

So it is possible to clean up your GitHub manually and this might be the most suitable way if you’re only wanting to delete 1-2 repositories. But let’s say you’ve forked over fifty repositories. Manually going into each one, finding the delete button in the settings and typing in the confirmation prompt is not what you want to spend your day doing. As with all manual methods, pointing and clicking does not scale particularly well.

Using the package

To use the package, you first need to generate a Personal Access Token (PAT).

Getting a token

Creating a personal access token to be able to use the GitHub API is easy. You can either navigate to the page on GitHub (Settings > Developer Settings > Personal Access tokens > Generate new token), or you can use the handy create_github_token() function from which will open the same page in your browser.

Adding a new Personal access token.

From there, you give your token a useful name as well as select what access should be granted by the token. Note: if you want to use to delete unwanted forked repositories, you will need to select the delete_repo scope.

Setting the delete_repo scope for your token.

However, be aware that this allows you to delete any repo — not just forked ones. After deciding on the scopes, you generate your token. As the page tells you, you will have to store your token somewhere as you won’t be able to access it again after closing the page. We recommend copying it and storing it in a password manager such as LastPass. Once you have saved your token somewhere secure, you can make it available to your R environment using the set_github_pat() function from the package which will prompt you to enter your PAT, which you did save somewhere… right? If you did not follow our advice and now no longer have access to your PAT, don’t worry, you can delete the old one on GitHub and generate a new one.

Viewing existing tokens

OK, now that you’ve definitely got your token ready, you can run the code below

which will prompt you to enter your PAT. Now you can finally get to the cleaning!

Cleaning

We will load the package, as well as the package to get access to pipes.

Step one is to retrieve your repositories

The GitHub API is paginated. This means it returns results in pages, with at most 100 results per page. If

is less than 100, then you don’t need to worry. If you have more than 100 repositories, you can either choose a page or loop through all pages.

The object my_repos is now a list of repositories. Each element of the list is a particular repository. We are interested in two particular elements: name and fork :

These elements tell us the name of the repository and whether it was created as a result of forking. Now we just repeat this process for all of our repositories and filter to return only the repositories which are forked.

The next step involves manually, and very carefully selecting the repositories you want to delete. If you want to delete all forked repositories (!), simply set

Otherwise, create a vector of repositories to delete

Finally we delete using

And… they’re gone!

Deleting forked repositories like this is an effective way to clean out your GitHub of repositories that you haven’t looked at or touched in a while. However, unlike doing it manually, there is no confirmation where you have to type out a specific repository’s name to confirm that you actually are deleting what you want to be deleting. So, be extremely careful when deleting repositories using as you don’t want to lose hours of work by accidentally running the wrong line.

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *

Luxury Car Rental in Miami | Reserve a Premium Vehicle with RealCar