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 será descontinuada em Esta versão do GitHub Enterprise foi descontinuada em 2020-05-23. No patch releases will be made, even for critical security issues. For better performance, improved security, and new features, upgrade to the latest version of GitHub Enterprise. For help with the upgrade, contact GitHub Enterprise support.

Versão do artigo: Enterprise Server 2.17

Ignorar arquivos

You can configure Git to ignore files you don't want to check in to GitHub Enterprise.

Neste artigo

Configuring ignored files for a single repository

You can create a .gitignore file in your repository's root directory to tell Git which files and directories to ignore when you make a commit. To share the ignore rules with other users who clone the repository, commit the .gitignore file in to your repository.

GitHub maintains an official list of recommended .gitignore files for many popular operating systems, environments, and languages in the github/gitignore public repository. É possível usar gitignore.io para criar um arquivo .gitignore para seu sistema operacional, linguagem de programação ou Ambiente de Desenvolvimento Integrado (IDE, Integrated Development Environment). For more information, see "github/gitignore" and the "gitignore.io" site.

  1. Open TerminalTerminalGit Bash.
  2. Navigate to the location of your Git repository.
  3. Create a .gitignore file for your repository.
    $ touch .gitignore

For an example .gitignore file, see "Some common .gitignore configurations" in the Octocat repository.

If you want to ignore a file that is already checked in, you must untrack the file before you add a rule to ignore it. From your terminal, untrack the file.

$ git rm --cached FILENAME

Configuring ignored files for all repositories on your computer

You can also create a global .gitignore file to define a list of rules for ignoring files in every Git repository on your computer. Por exemplo, você deverá criar o arquivo em ~/.gitignore_global e adicionar algumas regras a ele.

  1. Open TerminalTerminalGit Bash.
  2. Configure Git to use the exclude file ~/.gitignore_global for all Git repositories.
    $ git config --global core.excludesfile ~/.gitignore_global

Excluding local files without creating a .gitignore file

Se você não quiser criar um arquivo .gitignore para compartilhar com outras pessoas, é possível criar regras sem fazer o commit no repositório. Você pode usar essa técnica para arquivos que você gerou localmente e que não espera que outros usuários o façam, como arquivos criados pelo seu editor.

Use seu editor de textos preferido para abrir o arquivo .git/info/exclude dentro da raiz do repositório Git. Qualquer regra que você adicionar aqui não será verificada e ignorará arquivos somente em seu repositório local.

  1. Open TerminalTerminalGit Bash.
  2. Navigate to the location of your Git repository.
  3. Abra o arquivo .git/info/exclude com seu editor de texto preferido.

Leia mais

Pergunte a uma pessoa

Não consegue encontrar o que procura?

Entrar em contato