Skip to main content

このバージョンの GitHub Enterprise はこの日付をもって終了となりました: 2022-10-12. 重大なセキュリティの問題に対してであっても、パッチリリースは作成されません。 パフォーマンスの向上、セキュリティの向上、新機能の向上を図るために、最新バージョンの GitHub Enterprise にアップグレードします。 アップグレードに関するヘルプについては、GitHub Enterprise サポートにお問い合わせく� さい

Getting permanent links to files

When viewing a file on your GitHub Enterprise Server instance, you can press the "y" key to update the URL to a permalink to the exact version of the file you see.

Tip: Press "?" on any page in GitHub Enterprise Server to see all available keyboard shortcuts.

File views show the latest version on a branch

When viewing a file on your GitHub Enterprise Server instance, you usually see the version at the current head of a branch. For example:

refers to GitHub's codeql repository, and shows the main branch's current version of the README.md file.

The version of a file at the head of branch can change as new commits are made, so if you were to copy the normal URL, the file contents might not be the same when someone looks at it later.

For a permanent link to the specific version of a file that you see, instead of using a branch name in the URL (i.e. the main part in the example above), put a commit id. This will permanently link to the exact version of the file in that commit. For example:

replaces main with a specific commit id and the file content will not change.

Looking up the commit SHA by hand is inconvenient, however, so as a shortcut you can type y to automatically update the URL to the permalink version. Then you can copy the URL knowing that anyone you share it with will see exactly what you saw.

Tip: You can put any identifier that can be resolved to a commit in the URL, including branch names, specific commit SHAs, or tags!

You can create a permanent link to a specific line or range of lines of code in a specific version of a file or pull request. For more information, see "Creating a permanent link to a code snippet."

Further reading