Skip to main content

This version of GitHub Enterprise Server was discontinued on 2024-09-25. 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 Server. For help with the upgrade, contact GitHub Enterprise support.

Creating new files

You can create new files directly on GitHub Enterprise Server in any repository you have write access to.

When creating a file on GitHub Enterprise Server, consider the following:

Warning

Never git add, commit, or push sensitive information, for example passwords or API keys, to a remote repository. If you've already added this information, see "Removing sensitive data from a repository."

  1. On GitHub, navigate to the main page of the repository.

  2. In your repository, browse to the folder where you want to create a file.

  3. Above the list of files, using the Add file drop-down, click Create new file.

  4. In the file name field, type the name and extension for the file. To create subdirectories, type the / directory separator.

  5. In the file contents text box, type content for the file.

  6. To review the new content, above the file contents, click Preview.

    Screenshot of a file in edit mode. Above the text box for editing file contents, a tab, labeled "Preview", outlined in dark orange.

  7. In the "Commit message" field, type a short, meaningful commit message that describes the change you made to the file. You can attribute the commit to more than one author in the commit message. For more information, see "Creating a commit with multiple authors."

  8. Below the commit message fields, decide whether to add your commit to the current branch or to a new branch. If your current branch is the default branch, you should choose to create a new branch for your commit and then create a pull request. For more information, see "Creating a pull request."

    Screenshot of a GitHub pull request showing a radio button to commit directly to the main branch or to create a new branch. New branch is selected.

  9. Click Commit changes or Propose changes.