LoginSignup
3
1

More than 3 years have passed since last update.

思い出しては忘れ、思い出して忘れ、以下略

Posted at

そのまま転記してます

  • 作業内容をメモしながら色々やるも上手くいかず(涙
  • そのメモをそのまま転記します。疲れた、眠い、寝たい...

はじめからインストールされている

  • git --versionで確認したら既にインストールされたいた
$ git --version
git version 2.17.1

--globalオプションじゃないとエラーを出力

$ git config global user.name ouraboros
fatal: not in a git directory
  • --globalでやるとエラー出ず
$ git config --global user.name ouraboros
$ git config --global user.email ouraboros@*******

GO言語用に作成したディレクトリにリポジトリをクローン

  • git clone https://github.com/ouraboros/go-playground.gitでリモートリポジトリ?を作成
git clone https://github.com/ouraboros/go-playground.git
Cloning into 'go-playground'...
remote: Enumerating objects: 6, done.
remote: Counting objects: 100% (6/6), done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 6 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (6/6), done.

何か分かり辛い(汗

  • CEのホスト名もgo-playgroundにしていた事を忘れた(
  • go-playground:~/go/go-playground/とgo-playgroundが2回来てしまうのと、 ホスト名とディレクトリ名が同じなのは後々混乱をもたらすと思う。
  • なのでgo_sandboxに名称変更
  • Github側のREADME.mdは連動して変更されないので手動で変更しましょう

名称変更後に改めてクローン

  • リポジトリ名称を変更後、改めてクローン
git clone https://github.com/ouraboros/go_sandbox.git
Cloning into 'go_sandbox'...
remote: Enumerating objects: 12, done.
remote: Counting objects: 100% (12/12), done.
remote: Compressing objects: 100% (7/7), done.
remote: Total 12 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (12/12), done.

ファイルの移動

  • 1番初めに作成したhello.goをgo_sandboxへ移動
  • git config --global --listではじめに登録した情報を参照出来る
$ git config --global --list
user.name=ouraboros
user.email=ouraboros@******

コミットする

  • git add hello.goでhello.goを追加
  • -mオプションでコメント付きコミット
$ git commit -m "add file hello.go"
[master 92aec6d] add file hello.go
 1 file changed, 7 insertions(+)
 create mode 100644 hello.go

リポジトリにプッシュするとエラーで失敗

$ git push
Username for 'https://github.com': ouraboros
Password for 'https://ouraboros@github.com':
remote: Invalid username or password.
fatal: Authentication failed for 'https://github.com/ouraboros/go_sandbox.git/'

2段階認証ではプロトコルが違うらしい

ssh鍵が登録されていない(そりゃそうだ

  • ssh -T git@github.comで接続テストするもNGs
$ ssh -T git@github.com
The authenticity of host 'github.com (***.***.***.***)' can't be established.
RSA key fingerprint is SHA256:**************************.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com,192.30.253.113' (RSA) to the list of known hosts.

ssh鍵を作成

$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/******/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/******/.ssh/id_rsa.
Your public key has been saved in /home/******/.ssh/id_rsa.pub.
The key fingerprint is:***************************************
SHA256: ouraboros@go-playground
The key's randomart image is:

もう一度確認

  • 改めてssh -Tを実行するとエラーが表示されず上手くいった様子
$ ssh -T git@github.com
Hi ouraboros! You've successfully authenticated, but GitHub does not provide shell access.

ダメ、眠たい

  • 眠たいので寝ます。お休みなさい
  • 今日は息子の誕生日だった。誕生日おめでとう>息子くん
3
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
1