GitHubへソースをアップロードする操作メモ

準備)

Windows版gitをダウンロードしてインストールしておく

https://git-for-windows.github.io/

1)GitHubで使っているアカウントを設定する

$ git  config  --global  user.name  hogehoge

2)メールアドレスを設定する

$ git  config  --global  user.email  hogehoge@yahoo.co.jp

3)WebのGitHubからSettings->Developer Settings->Personal access tokens->Tokens(classic)で新しいTokenを発行し設定する

コマンドの形式

$ git config --global url.https://ユーザーネーム:入手したトークン@github.com/.insteadOf https://github.com/

トークンがghp_abcabcabc123の場合は以下のようになる

$ git  config  --global url.https://hogehoge:ghp_abcabcabc123@github.com/.insteadOf  https://github.com/

4)このまま作業すると以下の警告が出るので設定する(改行のCRLFとLFの変換問題)

warning: in the working copy of '***.***', LF will be replaced by CRLF the next time Git touches it
$ git  config  --global  core.autoCRLF  false

5)ダウンロード、アップロードテストのフォルダを作る

$ mkdir temp

6)gitHub上に作っていたレポジトリをクローン(ローカルにコピーする)

$ git  clone  https://github.com/hogehoge/MyApp

7)クローンしたフォルダへ移動

$ cd MyApp

8)ソースファイルをいろいろ置いてみる

$ cp -r  xxxxx . 

.gitignoreがあることを確認する、もちろん中身も確認する(アップロード対象外にするファイル)

9)変更をaddする

$ git  add  --all  *

以下のような警告が出るがこれは無視する(以下のファイルは無視しますよーーという警告)

hint: "git config advice.addIgnoredFile false"

10)変更をcommitする

$ git  commit  -am  "first release"

11)アップロードする

$ git  push

これで完了