Gistに画像をアップする
Gistに画像をアップしたくて,トライして見ました.
Gist には既に damyarou / 0_2D-FEM_etc.md があり,この下に画像をアップするための手順です.
1. git が Mac 入っているか確認
私のMacでは既にインストールされていました.
$ git --version
git version 2.7.4 (Apple Git-66)
2. クローンを自分のMacに作成する
a_gist.txt の中身は以下のとおり.
git clone https://gist.github.com/damyarou/d01cfa4ff6b5e12398cc9a2de69f2633 ./damyarou
コマンドを実行するとクローンが作成される
xx@aaa ~ $ bash a_gist.txt
Cloning into './damyarou'...
remote: Counting objects: 5, done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 5 (delta 1), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (5/5), done.
Checking connectivity... done.
中身を確認.gistのファイルがコピーされている.
xx@aaa ~ $ cd damyarou
xx@aaa ~/damyarou $ ls
0_2D-FEM_etc.md 1_py_gmt_shape.py 2_py_gmt_model.py
3. アップロードしたいファイルをディレクトリに追加
ここでは,fig_gmt_shape.png と fig_gmt_model.png を追加する.
xx@aaa ~/damyarou $ ls
0_2D-FEM_etc.md 2_py_gmt_model.py fig_gmt_shape.png
1_py_gmt_shape.py fig_gmt_model.png
4. git add
ここではMacのディレクトリに入れただけなので以下を実行
xx@aaa ~/damyarou $ git add fig_gmt_shape.png
xx@aaa ~/damyarou $ git add fig_gmt_model.png
5. git commit
commitしようとしたら,e-mailアドレスとuser nameの確認入力を要求される
xx@aaa ~/damyarou $ git commit -m "add image"
*** Please tell me who you are.
Run
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
to set your account's default identity.
Omit --global to set the identity only in this repository.
fatal: unable to auto-detect email address (got 'xx@aaa.(none)')
xx@aaa ~/damyarou $
指示に従って情報を入力
xx@aaa ~/damyarou $ git config --global user.email aaaa@bbb.cc
xx@aaa ~/damyarou $ git config --global user.name damyarou
これでcommitできるようになる
xx@aaa ~/damyarou $ git commit -m "add image"
[master 69d0390] add image
2 files changed, 0 insertions(+), 0 deletions(-)
create mode 100644 fig_gmt_model.png
create mode 100644 fig_gmt_shape.png
6. git push
push. 途中 username と password を求められるので入力.
xx@aaa ~/damyarou $ git push
warning: push.default is unset; its implicit value has changed in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the traditional behavior, use:
git config --global push.default matching
To squelch this message and adopt the new behavior now, use:
git config --global push.default simple
When push.default is set to 'matching', git will push local branches
to the remote branches that already exist with the same name.
Since Git 2.0, Git defaults to the more conservative 'simple'
behavior, which only pushes the current branch to the corresponding
remote branch that 'git pull' uses to update the current branch.
See 'git help config' and search for 'push.default' for further information.
(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
'current' instead of 'simple' if you sometimes use older versions of Git)
Username for 'https://gist.github.com': damyarou
Password for 'https://damyarou@gist.github.com':
Counting objects: 4, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 261.19 KiB | 0 bytes/s, done.
Total 4 (delta 0), reused 0 (delta 0)
To https://gist.github.com/damyarou/d01cfa4ff6b5e12398cc9a2de69f2633
06d662c..69d0390 master -> master
xx@aaa ~/damyarou $
Gistに行ってみるとちゃんとアップロードされていました.
以上