Top Banner
sourceTreeのインストール git リモートリポジトリ作成 ローカルリポジトリ作成 add, commit, push
60

basic operation about git

Jan 13, 2017

Download

Technology

Shota Todoroki
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: basic operation about git

• sourceTreeのインストール

• git• リモートリポジトリ作成• ローカルリポジトリ作成

• add, commit, push

Page 2: basic operation about git

SourceTreeのインストール• https://www.sourcetreeapp.com/ よりダウンロード

クリックしてDL

Page 3: basic operation about git

• ダウンロードされたファイルを実行してインストール

クリックしてインストール開始

Page 4: basic operation about git

• セットアップウィザードが開始

Page 5: basic operation about git

• インストール先を選択

Page 6: basic operation about git

• インストールの準備完了

Page 7: basic operation about git

• セットアップ終了

Page 8: basic operation about git

Source Treeの初期設定• 最初に起動するとこんな感じ

• 「ライセンスに同意してね」とのこと

Page 9: basic operation about git

• gitなどのインストールがはじまる

• グローバル設定ファイルを作るかどうか尋ねられる

Page 10: basic operation about git

• アカウントの有無を尋ねられる

• SSHキーの設定について尋ねられる

Page 11: basic operation about git

以上で初期設定おわり

Page 12: basic operation about git

Source Treeを起動

• 最初に起動するとこんな感じ

Page 13: basic operation about git

初期設定

• gitにおけるユーザー名とメールアドレスを登録• ツール → オプション

Page 14: basic operation about git

• ユーザー名とメールアドレスを設定• これらがコミット時に個人を識別するユーザー名になる

ユーザー名メールアドレスを入力

Page 15: basic operation about git

• 入力例

[email protected]_name

Page 16: basic operation about git

はじめてのclone

• 「新規/クローンを作成する」をクリック

クリック

Page 17: basic operation about git

• リポジトリをクローンしてみましょう

Page 18: basic operation about git

リポジトリURLを入力

• リポジトリのURLを入力

Page 19: basic operation about git

• ローカルでの保存先を設定

保存先のパスを入力

ここを押せばGUI操作可能

https://github.com/user_name/repository.git

repository

repository

Page 20: basic operation about git

• 一通り設定ができたのでクローンしましょう

クリック

https://github.com/user_name/repository.git

repository

repository

Page 21: basic operation about git

• クローン成功!

Page 22: basic operation about git

ここをクリックすると、コミット履歴が見れます

Page 23: basic operation about git

• 上に行くほど最近のコミット

[email protected]>

Page 24: basic operation about git

GitBucketからcloneするときの注意点• cloneするときにはリポジトリのURLを入力• このとき○ HTTP clone URLをコピー

× ブラウザのURLをコピー

こっちだとダメ(Basic認証とGitの認証が衝突)githubならOK

ここをコピー(ボタンをクリックすればクリップボードに保存される)

https://github.com/user_name/repository.git

Page 25: basic operation about git

新規リポジトリをつくってみよう

• リモートリポジトリの作成

• ローカルリポジトリの作成

Page 26: basic operation about git

• ログイン

ユーザー名とパスワードを入力してSign in

26

リモートリポジトリを作成

Page 27: basic operation about git

• ログイン後

ユーザページに移動

27

リモートリポジトリを作成

Page 28: basic operation about git

• リポジトリ作成 (1/3)

New Repositoryボタンをクリック

28

リモートリポジトリを作成

Page 29: basic operation about git

• リポジトリ作成 (2/3)

リポジトリ名、公開・非公開設定を入力Create repositoryボタンをクリック

29

リモートリポジトリを作成

Page 30: basic operation about git

• リポジトリ作成 (3/3)

リモートリポジトリ完成!

30

リモートリポジトリを作成

Page 31: basic operation about git

ローカルリポジトリを作成

クリック

Page 32: basic operation about git

クリック

Page 33: basic operation about git

この例では ¥C:¥git¥git-zemi

• データの保存先を決める

Page 34: basic operation about git

• 空のローカルリポジトリができました

Page 35: basic operation about git

作成したローカルリポジトリとリモートリポジトリを

紐づけましょう

Page 36: basic operation about git

リモートリポジトリを登録

• リポジトリ->リポジトリ設定をクリック

Page 37: basic operation about git

クリック

Page 38: basic operation about git

• デフォルトリモートにチェックを入れ、先ほど作成したリポジトリURLを入力

https://github.com/user_name/repository.git チェック

Page 39: basic operation about git

• リモートの登録できました

https://github.com/user_name/repository.git

Page 40: basic operation about git

準備完了!

では、commit・pushしてみましょう

Page 41: basic operation about git

• ファイル追加• ファイル「README.md」を作成

• README.mdとは• そのリポジトリのトップページに表示される説明用ファイル• 書き方は、マークダウン方式に従う

Page 42: basic operation about git

• README.mdに適当に何か書いて保存

• 【注意】日本語を使う場合、UTF-8エンコーディングして保存• 文字化けします• メモ帳ではなく、Sublimeなどのエディタを使いましょう

Page 43: basic operation about git

• git add

クリックして更新

Page 44: basic operation about git

• 何やら画面が変わりました

Page 45: basic operation about git

こちらがステージングエリア

こちらがワーキングツリー

Page 46: basic operation about git

• ワーキングエリアにあるREADME.mdをクリックして選択(addしたいものを選択)

Page 47: basic operation about git

• 画面上部の「追加ボタン」をクリック

クリック

README.mdの左側のところにチェック入れてもOK

Page 48: basic operation about git

• ステージングエリアにREADME.mdが追加されました!

Page 49: basic operation about git

• README.mdをcommitする準備が整ったのでcommitします

Page 50: basic operation about git

• 画面上部の「コミットボタン」をクリック

クリック

Page 51: basic operation about git

• メッセージを書きましょう(日本語でも英語でも可)

クリックしてcommit

Page 52: basic operation about git

• コミット成功!

Page 53: basic operation about git

• 今のcommitを確認してみましょう

クリック

Page 54: basic operation about git

• 先程のcommitが確認できますね!

Page 55: basic operation about git

それでは、リモート(GitBucket)に今のcommitをpushしましょう

Page 56: basic operation about git

git push

• 画面上部の「プッシュボタン」をクリック

クリック

Page 57: basic operation about git

• pushしたい対象ブランチをチェック

チェック

クリック

Page 58: basic operation about git

• pushがはじまりました

Page 59: basic operation about git

• 認証を通してください...GitBucketのアカウントです

Page 60: basic operation about git

• リモートのmasterというブランチにローカルのmasterブランチがpushされました