Как удалить репозиторий на GitHub
Как новичок в работе с системой GitHub, столкнулся с вопросом — как удалить созданный на GitHub репозиторий?
Оказалось, что ничего сложного в этом нет. Однако, задача эта и не такая простая, как может показаться. По крайней мере, чисто интуитивно у меня не получилось ее выполнить — пришлось искать ответ в Сети.
Итак, у меня есть учетная запись на GitHub, под которой создана пара репозиториев. Один из этих репозиториев был создан в учебных целях, поэтому для моей дальнейшей работы он мне не пригодиться и его можно удалить.
Список репозиториев на GitHub
Для начала открою свою страничку на GitHub и посмотрю, какие репозитории у меня уже есть:

Один из репозиторев — — можно удалить.
Для этой цели нужно просто зайти в него по ссылке:

В правом нижнем углу окна браузера, в списке, имеется строка . Открываем ее, сразу же копируем имя репозитория в поле (оно нам понадобиться еще здесь) и прокручиваем страницу вниз, пока не находим раздел с устрашающим названием . В этой опасной зоне находим подраздел с одноименной кнопкой .
Жмем на эту кнопку и получаем в результате окно с предупреждением об удаленни репозитория. В окне запроса имени удаляемого репозитория вводим (или вставляем из буфера обмена) — :

Снова жму на кнопку, на этот раз с еще более страшным напоминанием о последствиях совершаемого мною шага. И все! Репозиторий удален:

Ничего сложного, но так сразу и не догадаешься, что нужно делать. Разработчики GitHub постарались и обезопасили пользователей от случайного удаления репозиториев с данными.
Красивая функция trackBy
Пример красивой функции trackBy для Angular. Функция понравилась своей лаконичностью:<% highlight typescript %>public trackByNumber = (_. … Continue reading
GitHub delete repository the RIGHT way [Step-by-Step]
navigate to the directory hosting the repo and run this command to Github delete repository on your command line.
The last step is to head over to the Github website and follow these to delete the target repository.
- Access the main page of the target repo.
- Click Settings on the navigation menu
- Scroll down until you see Danger Zone
- Click on Delete this repository
- Type the repo name and accept the warnings
The above are typical routes to Github delete repository. What if you want to explore the nitty-gritty of deleting the Github repository?
That is why it would help to find practical ways to Github delete repository by following this tutorial to the end. Let us get started.
Lab setup to practice Github delete repository
We will imitate a typical development environment where you create a repo, clone it, make commits and push the changes to Github. We will then assume we no longer need the repo and delete it on the command line and Github.com.
I am creating a repo called github_delete_repo on Github.
![GitHub delete repository the RIGHT way [Step-by-Step]](https://www.golinuxcloud.com/wp-content/uploads/new-repo-3-e1639587800517.png)
Copy the repo URL.
![GitHub delete repository the RIGHT way [Step-by-Step]](https://www.golinuxcloud.com/wp-content/uploads/clone-repo-e1639587829875.png)
Clone it on the command line.
![GitHub delete repository the RIGHT way [Step-by-Step]](https://www.golinuxcloud.com/wp-content/uploads/clone.png)
Let us build the repo locally before seeing examples of the Github delete repository.
We currently have one commit history and a README.md file.
![GitHub delete repository the RIGHT way [Step-by-Step]](https://www.golinuxcloud.com/wp-content/uploads/repo-state-1.png)
Let us create more files.
Stage the files
and commit them.
Repeat the process to create the third commit history.
Create two more files
Let us check the commit history.
We have three commits in the history.
![GitHub delete repository the RIGHT way [Step-by-Step]](https://www.golinuxcloud.com/wp-content/uploads/three-commits-1.png)
Now that we have an active repo with some commits to practice the Github delete repository, let us apply the setup to the command line before remote repo deletion.
Github delete repository using the command line
Github delete repository on the command line starts by identifying the location of the target repo. For that reason, it would help to understand how a repository exists on your computer before deleting it.
How Github repository resides on your computer
Initializing a repository on any directory creates a .git sub-directory on your computer. .git sub-directory has all the information about the tracked project, such as commits, commit objects and commit history.
The sub-directory is hidden on both command line or GUI by default. To see the folder on the command line or terminal, run the ls command with the -a flag, as follows:
or align the files and directories vertically by adding the -l flag.
![GitHub delete repository the RIGHT way [Step-by-Step]](https://www.golinuxcloud.com/wp-content/uploads/dot-git-sub-directory.png)
The limit of interacting with instantiated repo depends on the git init flag used. For instance, instantiating an empty repo without a flag allows you to create a file, stage, and commit changes to the repo.
On the other hand, most flags like —bare only allow you to do push or pull requests to the repo. This is because you lack a working directory to add changes or do commits. Here is brief information about standard git init flags:
Common flags determining interaction with the local git repository
The —bare flag enables you to handle push and pull requests only. You can neither add nor commit to the repo.
Running the command
makes git to ignore on the working directory when initializing the repo. The tracked files reside in the <project.git> folder.
template
The —template flag is crucial when creating a reference directory. Like the unflagged repo, the —template flag:
git init —template=<template_directory>
creates a repo with a .git subdirectory, enabling you to copy files.
separate
Instantiating a repo with the —separate flag:
creates a text file with the path to the target directory.
quiet
The —quiet flag allows you to only interact with the most critical messages, errors, and errors. You can either use
to instantiate a quiet repo.
shared
With the —shared flag
you can specify user permissions for pushing or pulling changes to the repo. Examples of permissions to configure are TRUE, FALSE, GROUP, ALL, or EVERYBODY.
Now that you know how the repo resides on your computer, let us see two typical ways to delete it on the command line.
Delete the root directory
This is a dangerous route to take when doing Github delete repository on the command line because you cannot recover any files after the action.
Think of the .git sub-directory as a room within a house. One way to destroy the room is to damage the entire house. In our case, we can create and delete a repository by removing the directory containing the .git sub-directory.
Let us get out of the cloned Github repo.
and create another repo
then initialize it
Listing all files
shows we have a .git sub-directory.
![GitHub delete repository the RIGHT way [Step-by-Step]](https://www.golinuxcloud.com/wp-content/uploads/github-delete-repo-on-CLI.png)
Let us return to the root directory
before deleting the target folder using the -rf flag, as follows:
Both repo and directory are gone!
Delete only the git sub-directory
Sometimes you need to delete a Github repo on the terminal or command line without clearing the files. Let us follow these steps to achieve that.
Navigate to the directory containing the .git sub-directory.
Check repo presence:
then run the following command to Github delete repository locally.
where rm stands for remove, -r means recursively removing the target files whose directory we have specified, whereas the -f flag means overriding every change till the up-to-date check.
Recheck the repository.

The local version of the Github repository got deleted.
Method-2: Github delete repository from the website
Deleting a repo on the Github website is pretty straightforward. Follow these steps to achieve that.
Step-1. Move to github.com
Click the Sign in tab to access to your Github account.
![GitHub delete repository the RIGHT way [Step-by-Step]](https://www.golinuxcloud.com/wp-content/uploads/Github-landing-page-e1639588283838.png)
![GitHub delete repository the RIGHT way [Step-by-Step]](https://www.golinuxcloud.com/wp-content/uploads/sign-in-page.png)
You get to the Sign in page, permitting you to view all your repos.
Let us find the github_delete_repo repo we created earlier among the list of repos.
Step-2. Access the main page of the target repo
Click on the target repo. We land on a repo’s page appearing, as follows:
![GitHub delete repository the RIGHT way [Step-by-Step]](https://www.golinuxcloud.com/wp-content/uploads/Github-delete-repo-main-page-e1639588333610.png)
Step-3. Click Settings on the navigation menu
![GitHub delete repository the RIGHT way [Step-by-Step]](https://www.golinuxcloud.com/wp-content/uploads/settings-tab-e1639588386222.png)
Click the highlighted Settings tab, as shown here.
Step-4. Scroll down until you see Danger Zone
You should the Change repository visibility, Transfer ownership, Archive this repository, and Delete this repository buttons.
![GitHub delete repository the RIGHT way [Step-by-Step]](https://www.golinuxcloud.com/wp-content/uploads/danger-zone-e1639588413360.png)
Step-5. Click on Delete this repository
![GitHub delete repository the RIGHT way [Step-by-Step]](https://www.golinuxcloud.com/wp-content/uploads/delete-this-repo-e1639588444895.png)
Step-6. Type the repo name and accept the warnings
Let us copy and paste the repo name, Stevealila/github_delete_repo , above the input box or type each letter until the box named I understand the consequences, delete this repository becomes active.
![GitHub delete repository the RIGHT way [Step-by-Step]](https://www.golinuxcloud.com/wp-content/uploads/confirm-deletion-e1639588488888.png)
Github redirects us to the main page with a success message, Your repository «Stevealila/github_delete_repo» was successfully deleted.
Conclusion
You can Github delete repository by discarding a directory containing the repo, removing the .git sub-directory on the command line, or following the steps outlined in this tutorial to delete the repo on the Github website.
Didn’t find what you were looking for? Perform a quick search across GoLinuxCloud
If my articles on GoLinuxCloud has helped you, kindly consider buying me a coffee as a token of appreciation.
For any other feedbacks or questions you can either use the comments section or contact me form.
Удаление репозитория
Вы можете удалить любой репозиторий или вилку, если вы являетесь владельцем организации или имеете права администратора для репозитория или вилки. При удалении репозитория, в котором создана вилка, вышестоящий репозиторий не удаляется.
Только участники с правами владельца для организации или правами администратора для репозитория могут удалить репозиторий организации. Если флажок Разрешить участникам удалять или передавать репозитории для этой организации не установлен, удалять репозитории организации могут только ее владельцы. Дополнительные сведения см. в разделе Роли репозиториев для организации.
При удалении общедоступного репозитория не удаляются его вилки.
Предупреждения
- Вложения выпуска и разрешения команды при удалении репозитория будут удалены без возможности восстановления. Это действие невозможно отменить.
- При удалении частного репозитория будут удалены все его вилки.
Некоторые удаленные репозитории можно восстановить в течение 90 дней после удаления. Дополнительные сведения см. в разделе Восстановление удаленного репозитория.
На GitHub.com перейдите на главную страницу репозитория. 1. Под именем репозитория щелкните
Параметры. Если вкладка «Параметры» не отображается, выберите раскрывающееся меню
и выберите пункт Параметры.

В разделе «Опасная зона» выберите Удалить этот репозиторий.

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

Щелкните Я понимаю последствия, удалить этот репозиторий.
Sorry, you have been blocked
This website is using a security service to protect itself from online attacks. The action you just performed triggered the security solution. There are several actions that could trigger this block including submitting a certain word or phrase, a SQL command or malformed data.
What can I do to resolve this?
You can email the site owner to let them know you were blocked. Please include what you were doing when this page came up and the Cloudflare Ray ID found at the bottom of this page.
Cloudflare Ray ID: 7a6ce5c4bc1a2dea • Your IP: Click to reveal 88.135.219.175 • Performance & security by Cloudflare