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

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

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

Ничего сложного, но так сразу и не догадаешься, что нужно делать. Разработчики GitHub постарались и обезопасили пользователей от случайного удаления репозиториев с данными.
Красивая функция trackBy
Пример красивой функции trackBy для Angular. Функция понравилась своей лаконичностью:<% highlight typescript %>public trackByNumber = (_. … Continue reading
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.

Under Danger Zone, click Delete this repository.

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

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.
Cleaning up git github repository without deleting .git directory
This article contains a general solution for the following issues. Why I insist on not delete the .git directory for the following kind of purposes? answer: read the Warning! section at the end of this article.
Issues:
- Un-track files already added to git repository based on the new updated .gitignore
- Removing files from git repository without deleting it from the local repository (disk)
- Applying .gitignore to committed files in git Github
- Reducing git repository size
- Clearing Github history
- Making the current commit the only (initial) commit in a git GitHub repository
- Deleting all commit history in Github
- You have already added/committed some files to your git repository and you then add some of them to your .gitignore. But these files will still be present in your repository index and want to get rid of them.
- Ignoring files that have already been committed to the repo.
- Removing files from git after adding/updating .gitignore
- Ignoring a directory from a git repo after it’s been added.
- git rm a file without deleting it from disk
- Removing all git histories
Attention:
Before proceeding anything:
- Make sure your .gitignore file is up-to-date and contains all the correct patterns you want to ignore.
- Use gitignore.io service to create useful .gitignore files for your project
Solutions:
1- Solution for both Remote repository and Local :
Attention! This solution will not keep your old commit history around since it will delete the master branch! and delivers you a new master branch
That’s it! It’s done and you have a clean history and repository!
Optional:
At the end to cleanup unnecessary files and optimize the local repository do this:
Read more about: git gc command here
2- Solution for local :
If you don’t have a remote repository and all are in local (disk) you can simply.
Step 1:
Commit all your changes, including your .gitignore file.
Step 2:
Remove everything from the repository or un-track all files in your git repository.
-
is for remove
- -r allow recursive removal
- — -cached will only remove files from the index. Your files will still be in disk
- The . indicates that all files in the current directory will be untracked.
- If you want un-track a specific single file do this:
If you want un-track a single directory do this:
Step 3:
Re add everything except those that match rules in your .gitignore and then commit them.
Then your repository is clean!
Warning!
If you follow the brute-force approach:
And want to reconstruct the git repo with only the current content and finally do:
This might bring some problems! It also removes the configuration of the git repository ( .git/config ). Deleting .git/ always causes huge issues when you have git submodules.
Как полностью очистить репозиторий git, не удаляя его
Как удалить все файлы и папки, которые я храню в Git repo, но сохранить репозиторий? Есть ли какая-то команда для перезапуска git repo? Я нашел много примеров, но я сделал еще больший беспорядок. Хранилище связано. Так что если кто-то готов объяснить мне, шаг за шагом я был бы очень благодарен.
2 ответов
если у вас есть только локальный репозиторий Git
если вы хотите стереть всю свою историю и начать снова:
и снова начать совершать.
если вы хотите удалить файлы и историю:
и начать добавлять файлы и совершении.
если вы связаны с удаленным репозиторием если вы хотите начать все сначала, но на самом деле не возражаете против какой-то старой истории; есть быстрый способ:
теперь ваш репозиторий снова пуст, у вас останется только старая история. если вы также хотите очистить всю свою историю; это займет немного больше работы (и обратите внимание, что это вызовет проблемы для всех, кто связан с тем же удаленным репозиторием):
обратите внимание, что я создаю пустой файл README для первой фиксации, так как фиксация не может быть пустым.
Если вы говорите о существующем удаленном РЕПО (а не только локальном РЕПО, что тривиально делать), вы можете: