年初めgithub導入1

よーしコード書いたぞ!公開しよう!と思ったので、導入しよう、github
githubを使ってコードを公開するまで。

環境:Mac
gitのバージョン:2.10.1

gitのダウンロード

Git - Downloading Package
ダウンロードが終わったらダブクリしてインストーラーの指示に従って進める。
なんやかんやするとインストールできる。

インストール確認

ターミナルで以下入力。

$ git --version
git version 2.10.1

できたー。

githubアカウントの作成

https://github.com/にアクセスしてアカウントを作る。

そして
今さら聞けない!GitHubの使い方【超初心者向け】 | TechAcademyマガジン
を参考に進めよう。。。ありがとうございます。。。

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

ターミナルで以下を入力。

--リポジトリ用のディレクトリを作成。
$ mkdir awesome
$ cd awesome
$ git init
--git initでカレントディレクトリをgitリポジトリにする。
$ git init
Initialized empty Git repository in /*****/awesome/.git/
何もないって言われたけどまあ何もないから大丈夫だろ。。
ファイルをローカルリポジトリに追加

公開したいファイルを追加するぞー。
適当なファイルを作ってさっき作ったローカルリポジトリディレクトリに入れます。
そんで以下コマンドを略。

$ git add modal_jquery.html

git addってかいてあるのだけどsourcetreeで言うところのステージングってことなのかな。
本当だったらgitから学ぶべきなんだろうな。。
git addはローカルレポジトリのインデックスへの一時保存。

更新結果をローカルリポジトリにコミットする

コミットだ〜

$ git commit -m “add new file”

$ git commit -m “add new file”
error: pathspec 'new' did not match any file(s) known to git.
error: pathspec 'file”' did not match any file(s) known to git.

ええ〜??

$ git commit

[master (root-commit) d16d21b]  Changes to be committed: 	new file:   modal_jquery.html
 Committer: ***
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly. Run the
following command and follow the instructions in your editor to edit
your configuration file:

    git config --global --edit

After doing this, you may fix the identity used for this commit with:

    git commit --amend --reset-author

 1 file changed, 29 insertions(+)
 create mode 100644 modal_jquery.html

眠くて何言ってるかわかんねーです。。。
てかもしかしてMacのターミナルの使い方がわかってない的な気がしてきた。。
コミット自体は出来ているっぽいですね。

検索したらば
現場で使うGitのテクニック - Qiita

要するにgit configの事なのですが設定していないとコミットする際にデフォルトで、
名前: マシンに設定された名前
メールアドレス: 【ユーザ名】@【ホスト名】
という情報が使われます。(コミット自体ができないかと思いきや、できるのはできるんですね)

な、なるほど、、、そりゃそうだ、、
思いっきり自分の名前がバカスカ出てたけどそういう、、なるほど、、

続きは明日。。