リポジトリをコピーしてファイルを追加する
宇宙ステーションのファイルを追加して共有する場所ができたので、これをローカル システムから取得する方法が必要です。これをセットアップするにはまず、Bitbucket リポジトリをシステムにコピーします。Sourcetree では、リポジトリをコピーすることを「複製する」と言います。リポジトリを複製する際には、セルフホスト型のサーバーとローカル システムの間の接続を作成します。
ステップ 1. リポジトリをローカル システムにクローンする
Sourcetree を使用して、コマンド ラインを使用せずに、リポジトリのクローンをローカル システムへ作成します。
Bitbucket の使用頻度が増えると、複数のリポジトリで作業するようになる可能性があります。そのため、すべてのリポジトリを含むディレクトリを作成することをおすすめします。まず、ローカル システムでディレクトリを作成し、
reposという名前をつけます。Bitbucket で、BitbucketStationSupplies リポジトリへ移動します。
Select the Clone button in the top right corner. Bitbucket displays the Clone this repository dialog.
From the Clone this repository dialog, select Clone in Sourcetree.
From the Clone New dialog, update the Destination Path to
<local directory>/repos/bitbucketstationsupplies. This destination path refers to the directory you just created with the folder for the repository. The Name field remains the same with the folder name of the repository.[クローン] ボタンを選択します。
おめでとうございます。ローカル システムにリポジトリをクローンしました。
ステップ 2. ファイルを作成してローカルに追加し、Bitbucket にプッシュする
ローカル システムにリポジトリがあるため、宇宙ステーションに必要なすべてのサプライのリストの作成を開始することができます。これを行うため、サプライ用のファイルを作成しましょう。
Sourcetree で
bitbucketstationsuppliesリポジトリをダブルクリックすると、ローカル リポジトリからリモート リポジトリへコミットするものがないことを確認できます。テキスト エディターを使用して次の 3 行を追加します。
space ice cream nerf darts telescope light shieldファイルを
supplies.txtとして、ローカル システム上のbitbucketstationsuppliesディレクトリに保存します。supplies.txtファイルをローカル リポジトリで作成したため、これが Sourcetree に表示されるようになりました。
4. ここで一連の変更のスナップショットを準備した後、正式な履歴へとコミットできます。supplies.txt ファイルのオプション メニューから [ステージファイル] を選択します。
5. Select the Commit button at the top to commit the file.
6. In the message box, enter "Initial commit."
7. Select the Commit button under the box. Your new file is now committed to the project history. Up until this point, everything you have done is on your local system and is invisible to your Bitbucket repository until you push those changes to your remote Bitbucket repository.
8. From Sourcetree, select the Push button to push your committed changes. Pushing lets you move one or more commits to another repository, which serves as a convenient way to publish contributions.
9. Select the master branch to indicate that you are pushing that branch to origin and select OK.
10. Go to your BitbucketStationSupplies repository in Bitbucket.
If you select Commits in the sidebar, you'll see your commit in the repository. Bitbucket combines all the things you just did into that commit and shows it to you.
If you select Source in the sidebar, you'll see your file in the repository, the supplies.txt file you just added.
この内容はお役に立ちましたか?