Skip to main content
ドキュメントには� �繁に更新が� えられ、その都度公開されています。本ページの翻訳はま� 未完成な部分があることをご了承く� さい。最新の情� �については、英語のドキュメンテーションをご参照く� さい。本ページの翻訳に問題がある� �合はこちらまでご連絡く� さい。

このバージョンの GitHub Enterprise はこの日付をもって終了となりました: 2022-06-03. 重大なセキュリティの問題に対してであっても、パッチリリースは作成されません。 パフォーマンスの向上、セキュリティの改善、新機能のためには、最新バージョンのGitHub Enterpriseにアップグレードしてく� さい。 アップグレードに関する支援については、GitHub Enterprise supportに連絡してく� さい。

プロジェクトに貢献する

Learn how to contribute to a project through forking.

About forking

After using GitHub by yourself for a while, you may find yourself wanting to contribute to someone else’s project. Or maybe you’d like to use someone’s project as the starting point for your own. This process is known as forking.

Creating a "fork" is producing a personal copy of someone else's project. Forks act as a sort of bridge between the original repository and your personal copy. You can submit pull requests to help make other people's projects better by offering your changes up to the original project. Forking is at the core of social coding at GitHub. 詳細は「リポジトリをフォークする」を参照してく� さい。

リポジトリをフォークする

This tutorial uses the Spoon-Knife project, a test repository that's hosted on GitHub.com that lets you test the fork and pull request workflow.

  1. Navigate to the Spoon-Knife project at https://github.com/octocat/Spoon-Knife.
  2. Click Fork. [Fork] ボタン
  3. GitHub Enterprise Server will take you to your copy (your fork) of the Spoon-Knife repository.

Cloning a fork

You've successfully forked the Spoon-Knife repository, but so far, it only exists on GitHub Enterprise Server. To be able to work on the project, you will need to clone it to your computer.

You can clone your fork with the command line, GitHub CLI, or GitHub Desktop.

  1. GitHub Enterprise Server で、Spoon-Knife リポジトリの自分のフォークに移動します。

  2. ファイルのリストの上にある Code(コード)をクリックしてく� さい。 "Code"ボタン

  3. Copy the URL for the repository.

    • To clone the repository using HTTPS, under "HTTPS", click .
    • Organization の SSH 認証局から発行された証明書を含む SSH キーを使用してリポジトリのクローンを作成するには、[SSH]、 の� �にクリックします。
    • To clone a repository using GitHub CLI, click GitHub CLI, then click . GitHub CLIでリポジトリをクローンするためのURLをコピーするためのクリップボードアイコン
  4. ターミナルターミナルGit Bashを開いてく� さい。

  5. カレントワーキングディレクトリを、ディレクトリをクローンしたい� �所に変更します。

  6. git clone と入力し、前の手� �でコピーした URL を貼り付けます。 次のようになるはずです (YOUR-USERNAME はあなたの GitHub Enterprise Server ユーザ名に置き換えてく� さい):

    $ git clone https://hostname/YOUR-USERNAME/Spoon-Knife
  7. Enter を押します。 これで、ローカルにクローンが作成されます。

    $ git clone https://hostname/YOUR-USERNAME/Spoon-Knife
    > Cloning into `Spoon-Knife`...
    > remote: Counting objects: 10, done.
    > remote: Compressing objects: 100% (8/8), done.
    > remove: Total 10 (delta 1), reused 10 (delta 1)
    > Unpacking objects: 100% (10/10), done.

To learn more about GitHub CLI, see "About GitHub CLI."

To create a clone of your fork, use the --clone flag.

gh repo fork repository --clone=true
  1. Fileメニューで、Clone Repository(リポジトリのクローン)をクリックしてく� さい。

    Mac アプリケーション内の [Clone] メニューオプション

    Windows アプリケーション内の [Clone] メニューオプション

  2. クローンしたいリポジトリの� �所に対応するタブをクリックしてく� さい。 URLをクリックし、リポジトリの� �所を入力することもできます。

    [Clone a repository] メニュー内の [Location] タブ

    [Clone a repository] メニュー内の [Location] タブ

  3. クローンしたいリポジトリをリストから選択します。

    リポジトリリストのクローン

    リポジトリリストのクローン

  4. Choose...(選択...)をクリックし、リポジトリをクローンしたいローカルのパスに移動してく� さい。

    Chooseボタン

    Chooseボタン

  5. Cloneをクリックします。

    Cloneボタン

    Cloneボタン

Making and pushing changes

Go ahead and make a few changes to the project using your favorite text editor, like Visual Studio Code. You could, for example, change the text in index.html to add your GitHub username.

When you're ready to submit your changes, stage and commit your changes. git add . tells Git that you want to include all of your changes in the next commit. git commit takes a snapshot of those changes.

git add .
git commit -m "a short description of the change"
git add .
git commit -m "a short description of the change"

For more information about how to stage and commit changes in GitHub Desktop, see "Committing and reviewing changes to your project."

When you stage and commit files, you essentially tell Git, "Okay, take a snapshot of my changes!" You can continue to make more changes, and take more commit snapshots.

Right now, your changes only exist locally. When you're ready to push your changes up to GitHub Enterprise Server, push your changes to the remote.

git push
git push

For more information about how to push changes in GitHub Desktop, see "Pushing changes to GitHub."

Making a pull request

At last, you're ready to propose changes into the main project! This is the final step in producing a fork of someone else's project, and arguably the most important. If you've made a change that you feel would benefit the community as a whole, you should definitely consider contributing back.

To do so, head on over to the repository on GitHub Enterprise Server where your project lives. For this example, it would be at https://www.github.com/<your_username>/Spoon-Knife. You'll see a banner indicating that your branch is one commit ahead of octocat:main. Click Contribute and then Open a pull request.

GitHub Enterprise Server will bring you to a page that shows the differences between your fork and the octocat/Spoon-Knife repository. Create pull requestをクリックします。

GitHub Enterprise Server will bring you to a page where you can enter a title and a description of your changes. It's important to provide as much useful information and a rationale for why you're making this pull request in the first place. The project owner needs to be able to determine whether your change is as useful to everyone as you think it is. Finally, click Create pull request.

Managing feedback

Pull Requests are an area for discussion. In this case, the Octocat is very busy, and probably won't merge your changes. For other projects, don't be offended if the project owner rejects your pull request, or asks for more information on why it's been made. It may even be that the project owner chooses not to merge your pull request, and that's totally okay. Your copy will exist in infamy on the Internet. And who knows--maybe someone you've never met will find your changes much more valuable than the original project.

Finding projects

You've successfully forked and contributed back to a repository. Go forth, and contribute some more!