Skip to main content

附加文件

可通过将各种文件类型附加到议题和拉取请求来传达信息。

谁可以使用此功能?

Markdown can be used in the GitHub web interface.

Note

For public repositories, uploaded files can be accessed without authentication. In the case of private and internal repositories, only people with access to the repository can view the uploaded files.

To attach a file to an issue or pull request conversation, drag and drop it into the comment box. Alternatively, you can click in the formatting bar above the comment box to browse, select, and add a file from your computer.

Screenshot of the comment box. The "Attach files" icon is outlined in orange.

When you attach a file, it is uploaded immediately to GitHub and the text field is updated to show the anonymized URL for the file. For more information on anonymized URLs see "About anonymized URLs."

Note

In many browsers, you can copy-and-paste images directly into the box.

The maximum file size is:

  • 10MB for images and gifs
  • 10MB for videos uploaded to a repository owned by a user or organization on a free GitHub plan
  • 100MB for videos uploaded to a repository owned by a user or organization on a paid GitHub plan
  • 25MB for all other files

Note

To upload videos greater than 10MB to a repository owned by a user or organization on a paid GitHub plan, you must either be an organization member or outside collaborator, or be on a paid plan.

We support these files:

  • PNG (.png)

  • GIF (.gif)

  • JPEG (.jpg, .jpeg)

  • SVG (.svg)

  • Log files (.log)

  • Markdown files (.md)

  • Microsoft Word (.docx), PowerPoint (.pptx), and Excel (.xlsx) documents

  • Text files (.txt)

  • Patch files (.patch)

    Note

    If you use Linux and try to upload a .patch file, you will receive an error message. This is a known issue.

  • PDFs (.pdf)

  • ZIP (.zip, .gz, .tgz)

  • Video (.mp4, .mov, .webm)

    Note

    Video codec compatibility is browser specific, and it's possible that a video you upload to one browser is not viewable on another browser. At the moment we recommend using H.264 for greatest compatibility.