Skip to main content

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

Adding a file to a repository

You can upload and commit an existing file to a repository on GitHub Enterprise Server or by using the command line.

Adding a file to a repository on GitHub Enterprise Server

Files that you add to a repository via a browser are limited to 25 MB per file. You can add larger files, up to 100 MB each, via the command line. For more information, see "Adding a file to a repository using the command line." To add files larger than 100 MB, you must use Git Large File Storage. For more information, see "About large files on GitHub Enterprise Server."

Tips:

  • You can upload multiple files to GitHub Enterprise Server at the same time.
  • リポジトリに保護されたブランチがある� �合、GitHubを使ってその保護されたブランチ中のファイルを編集したり、保護されたブランチにファイルをアップロードしたりすることはできません。 詳細については、「保護されたブランチについて」を参照してく� さい。

GitHub Desktopを使って、変更を新しいブランチに移動させてコミットできます。 詳細については、「プロジェクトへの変更のコミットやレビュー」を参照してく� さい。

  1. On your GitHub Enterprise Server instance, navigate to the main page of the repository.
  2. Above the list of files, using the Add file drop-down, click Upload files. "Upload files" in the "Add file" dropdown
  3. Drag and drop the file or folder you'd like to upload to your repository onto the file tree. Drag and drop area
  4. ページの下部で、ファイルに対して行った変更を説明する短く分かりやすいコミットメッセージを入力してく� さい。 コミットメッセージでは、複数の作者にコミットを関連づけることができます。 詳細については、「複数の共同作成者とのコミットの作成」を参照してく� さい。 変更のコミット メッセージ
  5. コミットメッセージフィールドの下で、コミットの追� 先を現在のブランチか新しいブランチから選択してく� さい。 現在のブランチがデフォルトブランチなら、コミット用に新しいブランチを作成してからPull Requestを作成すべきです。 詳細については、「新しい pull request の作成」を参照してく� さい。 コミット ブランチのオプション
  6. Click Commit changes. Commit changes button

Adding a file to a repository using the command line

You can upload an existing file to a repository on your GitHub Enterprise Server instance using the command line.

この手� �は、以下が済んでいることを前提としています。

警告: リモート リポジトリに機密情� �を、決して git addcommit、または push しないでく� さい。 センシティブな情� �には以下が含まれますが、以下に限定はされません。

詳細については、「Removing sensitive data from a repository」 (リポジトリからの機密データの削除) を参照してく� さい。

  1. On your computer, move the file you'd like to upload to GitHub Enterprise Server into the local directory that was created when you cloned the repository.
  2. [ターミナル][ターミナル][Git Bash] を開きます。
  3. ワーキングディレクトリをローカルのリポジトリに変更します。
  4. コミットに備えてローカルリポジトリにファイルをステージングしてく� さい。
    $ git add .
    # Adds the file to your local repository and stages it for commit. ファイルをステージング解除するには、'git reset HEAD YOUR-FILE' を使用します。
  5. ローカルリポジトリでステージングしたファイルをコミットしてく� さい。
    $ git commit -m "Add existing file"
    # Commits the tracked changes and prepares them to be pushed to a remote repository. このコミットを削除してファイルを変更するには、'git reset --soft HEAD~1'を使い、コミットしてからファイルを再度追� してく� さい。
  6. Push the changes in your local repository to your GitHub Enterprise Server instance.
    $ git push origin YOUR_BRANCH
    # Pushes the changes in your local repository up to the remote repository you specified as the origin

Further reading