Publicamos atualizações frequentes em nossa documentação, e a tradução desta página ainda pode estar em andamento. Para obter as informações mais recentes, acesse a documentação em inglês. Se houver problemas com a tradução desta página, entre em contato conosco.

Esta versão do GitHub Enterprise foi descontinuada em 2020-11-12. Nenhum lançamento de patch será feito, mesmo para questões críticas de segurança. Para obter melhor desempenho, melhorar a segurança e novos recursos, upgrade to the latest version of GitHub Enterprise. Para ajuda com a atualização, contact GitHub Enterprise support.

Creating a GitHub Pages site with Jekyll

You can use Jekyll to create a GitHub Pages site in a new or existing repository.

People with admin permissions for a repository can create a GitHub Pages site with Jekyll.

GitHub Pages is available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server.

Neste artigo

Prerequisites

Before you can use Jekyll to create a GitHub Pages site, you must install Jekyll and Git. For more information, see Installation in the Jekyll documentation and "Set up Git."

Recomendamos o uso do Bundler para instalar e executar o Jekyll. O Bundler gerencia as dependências do gem do Ruby, reduz os erros de compilação do Jekyll e evita erros relacionados ao ambiente. Para instalar o bundler:

  1. Instale o Ruby. Para obter mais informações, consulte "Instalar o Ruby" na documentação do Ruby.
  2. Instale o Bundler. Para obter mais informações, consulte "Bundler".

Dica: se vir um erro do Ruby ao tentar instalar o Jekyll usando o Bundler, talvez você precise usar um gerenciador de pacotes, como o RVM ou Homebrew, para gerenciar a instalação do Ruby. Para obter mais informações, consulte "Solução de problemas" na documentação do Jekyll.

Creating a repository for your site

Se o seu site for um projeto independente, você pode criar um novo repositório para armazenar o código-fonte do seu site. If your site is associated with an existing project, you can add the source code for your site to a gh-pages branch or a docs folder on the master branch in that project's repository. For example, if you're creating a site to publish documentation for a project that's already on GitHub Enterprise Server, you may want to store the source code for the site in the same repository as the project.

Se você deseja criar um site em um repositório existente, pule para a seção "Criar o seu site.

Warning: If your site administrator has enabled Public Pages, GitHub Pages sites are publicly available on the internet, even if the repository for the site is private. If you have sensitive data in your site's repository, you may want to remove it before publishing. For more information, see "Configuring GitHub Pages for your enterprise" and "About repository visibility."

  1. No canto superior direito de qualquer página, use o menu suspenso e selecione Novo repositório.
    Menu suspenso com a opção de criar um novo repositório
  2. Use o menu suspenso Proprietário e selecione a conta que você deseja que seja proprietária do repositório.
    Menu suspenso Owner (Proprietário)
  3. Digite um nome para o repositório e uma descrição opcional. Se você estiver criando um site de usuário ou organização, o seu repositório deve ser denominado <user>.github.io ou <organization>.github.io. Para obter mais informações, consulte "Sobre GitHub Pages".
    Campo Create repository (Criar repositório)
  4. Escolha uma visibilidade do repositório. Para obter mais informações, consulte "Sobre a visibilidade do repositório."
    Botões de opção para selecionar a visibilidade do repositório

Creating your site

Antes de criar seu site, você deve ter um repositório para seu site no GitHub Enterprise Server. Se você não estiver criando o site em um repositório existente, consulte "Criar um repositório para o site".

  1. Abra TerminalTerminalGit Bash.

  2. If you don't already have a local copy of your repository, navigate to the location where you want to store your site's source files, replacing PARENT-FOLDER with the folder you want to contain the folder for your repository.

    $ cd PARENT-FOLDER
  3. If you haven't already, initialize a local Git repository, replacing REPOSITORY-NAME with the name of your repository.

    $ git init REPOSITORY-NAME
    > Initialized empty Git repository in /Users/octocat/my-site/.git/
    # Creates a new folder on your computer, initialized as a Git repository
  4. Change directories to the repository.

    $ cd REPOSITORY-NAME
    # Changes the working directory
  5. If you're creating a project site, decide which publishing source you want to use. Para obter mais informações, consulte "Sobre GitHub Pages".

  6. Navegue até a fonte de publicação do seu site. Para obter mais informações sobre fontes de publicação, consulte "Sobre o GitHub Pages". For example, if you chose to publish your site from the docs folder on the default branch, create and change directories to the docs folder.

    $ mkdir docs
    # Creates a new folder called docs
    $ cd docs

    If you chose to publish your site from the gh-pages branch, create and checkout the gh-pages branch.

    $ git checkout --orphan gh-pages
    # 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" on the GitHub Pages site.

    • If you installed Bundler:
      $ bundle exec jekyll VERSION new .
      # Creates a Jekyll site in the current directory
    • If you don't have Bundler installed:
      $ jekyll VERSION new .
      # Creates a Jekyll site in the current directory
  8. Open the Gemfile that was created and follow the instructions in the Gemfile's comments to use GitHub Pages.

    Instructions for updating Gemfile

  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" on the GitHub Pages site.

    gem "github-pages", "~> VERSION", group: :jekyll_plugins
  10. Save and close the Gemfile.

  11. Optionally, test your site locally. For more information, see "Testing your GitHub Pages site locally with Jekyll."

  12. Add your GitHub Enterprise Server repository as a remote, replacing HOSTNAME with your enterprise's hostname, USER with the account that owns the repository, and REPOSITORY with the name of the repository.

    $ git remote add origin https://HOSTNAME/USER/REPOSITORY.git
    
  13. Push the repository to GitHub Enterprise Server, replacing BRANCH with the name of the branch you're working on.

    $ git push -u origin BRANCH
  14. Configure a sua fonte de publicação. Para obter mais informações, consulte "Configurar uma fonte de publicação para seu site do GitHub Pages".

  15. Em GitHub Enterprise Server, acesse o repositório do seu site.

  16. No nome do seu repositório, clique em Configurações.

    Botão de configurações do repositório

  17. Para ver seu site publicado, em "GitHub Pages", clique na URL do seu site.

    URL do seu site publicado

    Observação: podem ser necessários até 20 minutos para que as alterações no site sejam publicadas após o push delas no GitHub Enterprise Server. Se você não vir suas alterações no navegador após uma hora, consulte "Sobre erros de criação do Jekyll para sites de GitHub Pages".

Observação: Se os arquivos de origem de do site estão localizados na fonte de publicação padrão —mestre para sites de usuário e organização ou gh-pages para sites de projeto — mas seu site não fez a publicação automaticamente, certifique-se de que alguém com permissões de administrador e um endereço de e-mail verificado tenha feito push para a fonte de publicação.

Next steps

To add a new page or post to your site, see "Adding content to your GitHub Pages site using Jekyll."

É possível adicionar um tema do Jekyll ao site do GitHub Pages para personalizar a aparência do seu site. For more information, see "Adding a theme to your GitHub Pages site using Jekyll."