1
0
mirror of synced 2025-12-23 11:54:18 -05:00

Update creating-a-github-pages-site-with-jekyll.md (#2178)

* Update creating-a-github-pages-site-with-jekyll.md

The previous instructions for installing the `github-pages` gem via the Gemfile were confusing. If you search for `could not find gem github-pages` in your favorite search engine, you'll find many people didn't uncomment the line and/or tried to run `bundle update github-pages` instead of `bundle install`. This is my attempt to make things clearer by being more specific step by step.

* Update step 7 as well

I was initially focused on steps 8-10, but I thought I should try all of the commands to make sure everything works. As far as I can tell, you cannot pass in a version number to the `jekyll new` command, at least not the way it was documented here. Also, the Bundler section is more confusing than helpful because for `bundle exec` to work, a Gemfile must exist in the directory, but the instructions don’t mention that. Instead of adding more steps, I thought it was easier to skip that section.

Because people installing Jekyll today will have version 4.2.0, and because github-pages only supports 3.9.0, one must run `bundle update` instead of `bundle install` to resolve all dependencies.

* Update content/github/working-with-github-pages/creating-a-github-pages-site-with-jekyll.md

Co-authored-by: Ben Whetton <ben.whetton@gmail.com>

* Update content/github/working-with-github-pages/creating-a-github-pages-site-with-jekyll.md

Co-authored-by: Ben Whetton <ben.whetton@gmail.com>

* Update content/github/working-with-github-pages/creating-a-github-pages-site-with-jekyll.md

Co-authored-by: hubwriter <hubwriter@github.com>

* Update content/github/working-with-github-pages/creating-a-github-pages-site-with-jekyll.md

Co-authored-by: hubwriter <hubwriter@github.com>

* Update creating-a-github-pages-site-with-jekyll.md

Co-authored-by: Moncef Belyamani <moncef@example.com>
Co-authored-by: Ben Whetton <ben.whetton@gmail.com>
Co-authored-by: hubwriter <hubwriter@github.com>
This commit is contained in:
Moncef Belyamani
2021-02-17 10:05:21 -05:00
committed by GitHub
parent 4a92ff1aa9
commit fc0f5a6674

View File

@@ -46,7 +46,7 @@ Before you can use Jekyll to create a {% data variables.product.prodname_pages %
$ git init <em>REPOSITORY-NAME</em> $ git init <em>REPOSITORY-NAME</em>
> Initialized empty Git repository in /Users/octocat/my-site/.git/ > Initialized empty Git repository in /Users/octocat/my-site/.git/
# Creates a new folder on your computer, initialized as a Git repository # Creates a new folder on your computer, initialized as a Git repository
``` ```
4. Change directories to the repository. 4. Change directories to the repository.
```shell ```shell
$ cd <em>REPOSITORY-NAME</em> $ cd <em>REPOSITORY-NAME</em>
@@ -65,24 +65,24 @@ Before you can use Jekyll to create a {% data variables.product.prodname_pages %
$ git checkout --orphan gh-pages $ git checkout --orphan gh-pages
# Creates a new branch, with no history or contents, called gh-pages and switches to the gh-pages branch # Creates a new branch, with no history or contents, called gh-pages and switches to the gh-pages branch
``` ```
7. To create a new Jekyll site, use the `jekyll new` command, replacing _VERSION_ with the current dependency version for Jekyll. For more information, see "[Dependency versions](https://pages.github.com/versions/)" on the {% data variables.product.prodname_pages %} site. 7. To create a new Jekyll site, use the `jekyll new` command:
- If you installed Bundler: ```shell
```shell $ jekyll new .
$ bundle exec jekyll <em>VERSION</em> new . # Creates a Jekyll site in the current directory
# Creates a Jekyll site in the current directory ```
``` 8. Open the Gemfile that Jekyll created.
- If you don't have Bundler installed: 1. Add "#" to the beginning of the line that starts with `gem "jekyll"` to comment out this line.
```shell 1. Add the `github-pages` gem by editing the line starting with `# gem "github-pages"`. Change this line to:
$ jekyll <em>VERSION</em> new .
# Creates a Jekyll site in the current directory ```shell
``` gem "github-pages", "~> GITHUB-PAGES-VERSION", group: :jekyll_plugins
8. Open the Gemfile that was created and follow the instructions in the Gemfile's comments to use {% data variables.product.prodname_pages %}. ```
![Instructions for updating Gemfile](/assets/images/help/pages/gemfile-instructions.png)
9. Update the `gem "github-pages"` line so that the line looks like this, replacing _VERSION_ with the current dependency version for `github-pages`. For more information, see "[Dependency versions](https://pages.github.com/versions/)" on the {% data variables.product.prodname_pages %} site. Replace _GITHUB-PAGES-VERSION_ with the latest supported version of the `github-pages` gem. You can find this version here: "[Dependency versions](https://pages.github.com/versions/)."
```shell
gem "github-pages", "~> <em>VERSION</em>", group: :jekyll_plugins The correct version Jekyll will be installed as a dependency of the `github-pages` gem.
```
10. Save and close the Gemfile. 10. Save and close the Gemfile.
11. From the command line, run `bundle update`.
11. Optionally, test your site locally. For more information, see "[Testing your {% data variables.product.prodname_pages %} site locally with Jekyll](/articles/testing-your-github-pages-site-locally-with-jekyll)." 11. Optionally, test your site locally. For more information, see "[Testing your {% data variables.product.prodname_pages %} site locally with Jekyll](/articles/testing-your-github-pages-site-locally-with-jekyll)."
12. Add your {% data variables.product.product_name %} repository as a remote, replacing {% if enterpriseServerVersions contains currentVersion or currentVersion == "github-ae@latest" %}_HOSTNAME_ with your enterprise's hostname,{% endif %} _USER_ with the account that owns the repository{% if enterpriseServerVersions contains currentVersion or currentVersion == "github-ae@latest" %},{% endif %} and _REPOSITORY_ with the name of the repository. 12. Add your {% data variables.product.product_name %} repository as a remote, replacing {% if enterpriseServerVersions contains currentVersion or currentVersion == "github-ae@latest" %}_HOSTNAME_ with your enterprise's hostname,{% endif %} _USER_ with the account that owns the repository{% if enterpriseServerVersions contains currentVersion or currentVersion == "github-ae@latest" %},{% endif %} and _REPOSITORY_ with the name of the repository.
```shell ```shell