ほつた@はてな

ほつたが技術的な事や個人的な出来事を中心に投稿します。

CoreOSでGithubへプッシュしようとしてかなり嵌った件

 

hotuta.hatenablog.com

 

 

hotuta.hatenablog.com

 

これらをやってみたもののこのままCoreOS上でvimを使って開発するのは辛いのでGithubにプッシュして扱いやすくしようとした矢先に事件が起こった。

Githubについてはもくもく会で理解して問題なし。

(こんな時に物凄く役に立ちました!)

github.com

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

参考

qiita.com

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.

 

 RSAがだめぽって言われる(´・ω・`)

ということで公開鍵と秘密鍵を作成しよう。

ここを参考に作る。

qiita.com

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 |
| |
| |
+-----------------+

.ssh/id_rsaに鍵があるみたいなので見に行く。

 使いこなれてないので適当に移動。

 

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に貼り付け登録でプッシュできるようになる。

と終盤省いて終了。

疲れた。