John Doe
John Doe

Reputation: 9764

Delete GitHub repo's Wiki

I'm new to GitHub. When I clicked a Wiki link a new Wiki was created for my repo. But I don't really need it. If I try to delete its only page, GitHub asks: "Are you sure you want to delete this page?". And I confirm that. And nothing happens, the page is still there. I can't say it's too annoying, but I'd like to know if there is a way to delete Wiki.

Upvotes: 32

Views: 11873

Answers (5)

pjz
pjz

Reputation: 43117

Deleting the wiki may also be necessary if you're moving from a paid private tier (which allows wikis on private repos) to the free tier (which doesn't).

Note that you can only disable Wikis (using the checkbox on the Settings page) on unarchived repos - archived repos don't have that option; to do so on them you'll have to temporarily un-archive them.

If you wish to preserve the content, one good option is to clone the wiki-repo the normal way:

git clone [email protected]:OWNER/REPO.wiki.git

and then go make a new repo named REPO-wiki on github. Then you can just edit your REPO.wiki/.git/config file and change one character in the url = under [remote "origin"] from REPO.wiki to REPO-wiki.

Upvotes: 0

cYrus
cYrus

Reputation: 2616

The easiest way I found is the following:

git clone [email protected]:$USER/$REPO.wiki
cd $USER/$REPO.wiki
git push origin --delete master

Then uncheck "Wikis" from "Settings" -> "Features".

Upvotes: 6

Tino
Tino

Reputation: 10489

The missing bits are on GitHub as always. Combined with the usual git-fu you can erase all data on a GitHub repo, for example destroy a wiki ACCOUNT/REPO.wiki.git:

git clone [email protected]:ACCOUNT/REPO.wiki.git
cd REPO.wiki
git checkout --orphan empty
git rm --cached -r .
git commit --allow-empty -m 'wiki deleted'
git push origin empty:master --force

Warning! This recipe allows to really destroy all data (on any repo) on GitHub, except for what may be still cached somewhere. My test shows that even

git clone --mirror [email protected]:ACCOUNT/REPO.wiki.git

cannot bring back any trace of old data afterwards. BTW learning to understand what above does is a good exercise in learning git ;)

Upvotes: 16

Belden
Belden

Reputation: 260

First, discover your repo's URL:

$ cd your-project
$ git remote -v
origin  [email protected]:belden/foo.git (fetch)
origin  [email protected]:belden/foo.git (push)

Clone your wiki; its URL is your project's URL, ending with 'wiki.git':

$ cd /tmp
$ git clone [email protected]:belden/foo.wiki.git foo-wiki
Cloning into 'foo-wiki'...
remote: Counting objects: 375, done.
remote: Compressing objects: 100% (159/159), done.
remote: Total 375 (delta 214), reused 375 (delta 214)
Receiving objects: 100% (375/375), 78.41 KiB, done.
Resolving deltas: 100% (214/214), done.

Now just treat it like a normal project that you want to delete files from:

$ cd foo-wiki
$ git rm *.md
$ git commit -am "remove wiki pages"
$ git push

And you're done.

Upvotes: 10

Blender
Blender

Reputation: 298582

Click on the Settings button on the GitHub page of your project and uncheck Wikis.

It should disappear.

Upvotes: 21

Related Questions