Fork GitHub project with custom wiki

感情迁移 提交于 2020-01-12 07:58:46

问题


When forking a project on GitHub, the wiki is cloned from the original project.

Am I right to assume that I can make any changes (delete pages, edit pages) to my forked wiki without changing the upstream wiki?

I've searched Google, Stack Overflow and the GitHub documentation without finding information about this :(


回答1:


Forking a GitHub project does not fork its wiki repo. A blank wiki is created instead in the fork, and any changes to it cannot be merged using pull requests. A workaround to this is to clone the GitHub wiki locally then push it into a separate repository, or a separate repository's wiki, e.g.:

git clone https://github.com/user1/project.wiki.git
git remote add my-fork https://github.com/user2/project.wiki.git
git push my-fork master

To keep the wikis in sync:

git pull origin master
git push my-fork master



回答2:


To clarify all the steps when using SSH.

git clone git@github.com:User1/Repo1.wiki.git
cd Repo1.wiki

# Now enable Wiki pages in Repo2

git remote add my-fork git@github.com:User2/Repo2.wiki.git

Pay attention to the use of : vs. / when using SSH. If something goes wrong here, you can't just repeat this command, so you need to manually change the url. To check what it is pointing to, use:

git config --local -l

# For example, this is wrong:
# remote.my-fork.url=git@github.com/User2/Repo2.wiki.git

If it is wrong, then set the correct URL with:

git config --local remote.my-fork.url git@github.com:User2/Repo2.wiki.git

Now you can continue with:

git push my-fork -f --no-tags

Where -f is shorthand for --force to overwrite all refs.




回答3:


Update 2015/2016: you need to clone the wiki separately

And a wiki does not support pull request anyway.


2013 (Original answer): As illustrated by this project, a GitHub fork would clone:

  • the repo
  • the wiki repo (which is originally hosted at https://github.com/user/project.wiki.git

So yes, you can fork and update the wiki without having to modify anything on the original upstream repo (the one you forked)



来源:https://stackoverflow.com/questions/16800999/fork-github-project-with-custom-wiki

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!