Notebook

これは日々の作業を通して学んだことや毎日の生活で気づいたことをを記録しておく備忘録である。

HTML ファイル生成日時: 2024/05/08 09:31:52.302 (台灣標準時)

git push するときにパスワードの入力を省略する方法

GitHub の repository に対して git push するときに、毎回、 token を打ち 込まないといけないでござる。しかしながら、 token は 40 文字もあり、と ても覚えられるものではないでござる。 git push するときに、パスワードと して token を打ち込まずともよくなる方法はないものか、と調べてみたら、 あるようだとわかったでござる。

まず、以下のコマンドを実行するでござる。


% git config credential.helper store

その後、通常通りに git push するでござる。


% git push
Username for 'https://github.com': my_github_account
Password for 'https://my_github_account@github.com': 
Enumerating objects: 8, done.
Counting objects: 100% (8/8), done.
Delta compression using up to 16 threads
Compressing objects: 100% (5/5), done.
Writing objects: 100% (5/5), 574 bytes | 574.00 KiB/s, done.
Total 5 (delta 2), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (2/2), completed with 2 local objects.
To https://github.com/my_github_account/my_repository.git
   0123456..abcdefg  main -> main

このときは、 token を打ち込まなければならないのでござるが、その後は token を入力せずとも、 git push が完了するでござる。


% git push
Enumerating objects: 13, done.
Counting objects: 100% (13/13), done.
Delta compression using up to 16 threads
Compressing objects: 100% (9/9), done.
Writing objects: 100% (12/12), 2.15 KiB | 2.15 MiB/s, done.
Total 12 (delta 1), reused 2 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (1/1), completed with 1 local object.
To https://github.com/my_github_account/my_repository.git
   1234567..bcdefgh  main -> main

ただし、パスワードは、平文で ~/.git-credentials というファイル内に書か れてしまうので、安全上の問題となりうるようでござる。もちろん、 ~/.git-credentials は所有者にしか見えないようになっているでござるが、 あまりよいことではないようでござる。



Frequently accessed files

  1. Computer___Python/20220518_0.html
  2. Computer___FreeBSD/20220621_0.html
  3. Food___Taiwan/20220429_0.html
  4. Computer___Network/20230516_00.html
  5. Computer___Python/20220715_0.html
  6. Computer___NetBSD/20220817_3.html
  7. Computer___Python/20220410_0.html
  8. Computer___Debian/20210223_1.html
  9. Food___Taiwan/20230526_00.html
  10. Food___Taiwan/20210205_5.html
  11. Computer___Python/20210124_0.html
  12. Computer___Network/20230508_00.html
  13. Computer___NetBSD/20220818_1.html
  14. Food___Taiwan/20210205_1.html
  15. Computer___NetBSD/20220428_0.html
  16. Science___Astronomy/20220503_0.html
  17. Computer___TeX/20230503_00.html
  18. Travel___Taiwan/20220809_2.html
  19. Computer___Network/20230726_00.html
  20. Computer___NetBSD/20210204_0.html
  21. Science___Math/20220420_0.html
  22. Computer___NetBSD/20230515_00.html
  23. Computer___NetBSD/20220808_0.html
  24. Science___Astronomy/20220420_1.html
  25. Computer___NetBSD/20230119_00.html
  26. Food___Taiwan/20230618_00.html
  27. Computer___Python/20220816_1.html
  28. Food___Taiwan/20220424_8.html
  29. Food___Taiwan/20220424_1.html
  30. Computer___NetBSD/20210204_2.html


HTML file generated by Kinoshita Daisuke.