CoreOSでGithubへプッシュしようとしてかなり嵌った件
これらをやってみたもののこのままCoreOS上でvimを使って開発するのは辛いのでGithubにプッシュして扱いやすくしようとした矢先に事件が起こった。
(こんな時に物凄く役に立ちました!)
CoreOS上で
まずGitの初期設定をしないといけない。
root@f33bd045d887:/sample/myapp# git config --global --list"
とやってみる。
>
空っぽみたい。
ここは保留してさっさと登録してみる。
$ git config --global user.name "名前" $ git config --global user.email "メールアドレス"
root@f33bd045d887:/sample/myapp# git config --global --list"
user.name=hotuta
user.email=XXXX@gmail.com
となった。
リポジトリの作成して
$ git init
リポジトリにすべてのファイルを反映させる
$ git add --all
参考
git commit -m "firstcommit"
git commit -m "初期コミット"
としたいんだけど何故か日本語入力ができなくて模索。
set input-meta on
set output-meta on
set convert-meta off
set meta-flag on
を/etc/inputrcに編集、追加すればいいらしい。
略
# Be 8 bit clean.
set input-meta on
set output-meta on
略
を
略
# Be 8 bit clean.
set input-meta on
set output-meta on
set convert-meta off
set meta-flag on
略
という感じ。
git log -1
で確認。
root@8a56a0f269e7:/sample/myapp# git log -1
commit eaee05628a82bcd71cc16477e2a8b46936f6acc8
Author: hotuta <XXXXX@gmail.com>
Date: Fri Aug 28 05:45:59 2015 +0000
初期コミット
root@8a56a0f269e7:/sample/myapp#
いよいよプッシュへ。
git remote add origin https://github.com/[githubアカウント]/[github上のリポジトリ名].git
git push -u origin master
とすると、
The authenticity of host 'github.com (192.30.252.128)' can't be established.
RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com,192.30.252.128' (RSA) to the list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
ということで公開鍵と秘密鍵を作成しよう。
ここを参考に作る。
root@8a56a0f269e7:/sample/myapp# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
e7:19:48:ed:56:48:24:23:e3:45:98:45:25:17:XX:XX root@8a56a0f269e7
The key's randomart image is:
+---[RSA 2048]----+
| XXXoB. |
| .E+ X . |
| .. . o . |
| . o . |
| S = |
| + o |
| o |
| |
| |
+-----------------+
使いこなれてないので適当に移動。
root@8a56a0f269e7:/sample/myapp#
root@8a56a0f269e7:/sample/myapp# cd ..
root@8a56a0f269e7:/sample# cd..
bash: cd..: command not found
root@8a56a0f269e7:/sample# cd .
root@8a56a0f269e7:/sample# cd
root@8a56a0f269e7:~# cd
root@8a56a0f269e7:~# ls
root@8a56a0f269e7:~# cd ..
root@8a56a0f269e7:/# cd .ssh
bash: cd: .ssh: No such file or directory
root@8a56a0f269e7:/# ls -a
. .dockerenv bin dev home lib64 mnt proc run sbin sys usr
.. .dockerinit boot etc lib media opt root sample srv tmp var
root@8a56a0f269e7:/# cd root
root@8a56a0f269e7:~# ls
root@8a56a0f269e7:~# ls -a
. .bash_history .bundle .gemrc .profile .subversion
.. .bashrc .gem .gitconfig .ssh .viminfo
root@8a56a0f269e7:~# cd .ssh
root@8a56a0f269e7:~/.ssh#
cat id_rsa.pubで確認。
Githubの設定のSSH kysに貼り付け登録でプッシュできるようになる。
と終盤省いて終了。
疲れた。