-
Notifications
You must be signed in to change notification settings - Fork 34
/
publish.Rmd
31 lines (20 loc) · 2.23 KB
/
publish.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
---
title: "Publish your site on Github"
output: html_document
---
### Add the repository to Github Desktop
4. If you can't already see your project folder then add your project folder to github desktop. Write a quick message in Summary then Press commit to queue it up and then Publish/Sync. This will add the site to your github repositories.
![](images/add_github_desktop.png)
5. Github will allow you to publish project websites for each of your repositories (known as `github pages` or `gh-pages`). They will end up being published at `yourusername.github.io/repositoryname`.
For example, the home for this website is [https://poldham.github.io/minute_website/](https://poldham.github.io/minute_website/)
![](images/website_address.png)
But, this is where we need to take care. In the image above on the left we can see that next to `Branch` it says `master`. Websites are published on the github pages branch (`gh-pages`) branch of a repository to keep them separate (because your repository data and your project website may be quite different things). So, your website is not yet published.
To publish the website we need to go into `Settings` in our repository and then scroll down. In the image below, where you see `master` in your repo change the branch to `gh-pages`. Your simple website will now build at the address given. You are reading this online so it must do.
![](images/website_gh_pages.png)
If you have forked and cloned this site then all should be good, because the master branch has been deleted leaving only the `gh-pages` branch. However, if you have started from scratch you will need the procedure above.
6. Troubleshooting. It can take a few minutes (but not long) for Github to recognise the website. If you see a not found message check three things.
- That you have a line saying `output_dir: "."` at the bottom of `_site.yml`.
- That you have `.nojekyll` in your main site folder.
- That there is an index.html (you remembered to move it from the `_site` folder when you updated... easy to forget).
- That you have selected the `gh-pages` branch in `Settings` in your repo.
- If you are using this site as your basis make sure that you have forked and then cloned the repository (the fork makes it your copy, a clone is just a copy).