KAEDE Hack blog

JavaScript 中心に ライブラリなどの使い方を解説する技術ブログ。

GitHub Setting Usage

GitHubにpushできるようになるまで

  1. GitHubのaccountを作ってRepositoryを作成する. 右上の+から。
  2. そこでclone用のURLをclip boardにcopyする, 何もまだローカルで書いてない場合はgit cloneで持ってきてそこで作業を始めるのが楽。
  3. Terminalを開いてcdでsetしたいdirectoryを開く
  4. git init で初期化
  5. git remote -v で確認
  6. git remote add origin https:.......でセットする
    two factor authをしている場合には //とgithub.comの間に@usernameを入れる。

あとはおなじみのadd, commit -m, pushのながれ。
うまくpushできなければ push -fとかで♪

追加

結構手順が異なる

kei-s-lifehack.hatenablog.com

GitHub Config Setting

  • 同じフォルダの.git/configに記述してある。
  • git config user.name (or emall)で確認, 追記できる こんな感じ
[remote "origin"]
        url = https://kaede0902@github.com/kaede0902/C_lang.git
        fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
        remote = origin
        merge = refs/heads/master
[user]
        name = kaede0902
        email = kaede0902js@gmail.com

Accountが二個目でTwo-Factor Authをしてしまっていると こっちもやらないとダメダメ

https://github.com/settings/tokens にアクセスして一時トークンの16進数を取得し、

https://username:HEXHEXHEXHEX@github.com/username/rep をgit clone or remote add originする。

次回以降はclone時にusername@を付け加えるだけでおkかも? 忘れたらvi .git/configで付け足しましょう。

REF

https://qiita.com/tq_jappy/items/6e2f81f372e4abaa5139

TIPS

  • commit -mはlocalに書き込む段階で, pushがその記録をwebにpushしてくれる。
  • commitのhistoryからdiff (どの行が+(追加) or -(削除) )かわかる

f:id:kei_s_lifehack:20190128012128p:plain
commit history