Git:GitHub

差分

このページの2つのバージョン間の差分を表示します。

この比較画面へのリンク

次のリビジョン
前のリビジョン
Git:GitHub [2021/12/12 22:16] – 作成 白くじらGit:GitHub [2025/04/12 05:15] (現在) – 外部編集 127.0.0.1
行 14: 行 14:
  
 [[https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token|公式サイト(個人アクセストークンの作成)]] [[https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token|公式サイト(個人アクセストークンの作成)]]
 +
 +
 +##### SSH認証
 +
 +[[https://qiita.com/non0311/items/03e3e7a042f70f072286|githubでユーザー名とパスワードを毎回聞かれる問題解消 - Qiita]]
 +
 +https通信を用いた方法だと、毎回アカウント(ユーザ,トークン)の入力が必要となる。
 +
 +ssh通信を設定すれば、入力が不要になる。
 +
 +- 現在のgitの通信確認方法
 +
 +```
 +$ git remote -v
 +```
 +
 +- gitのリポジトリ設定の確認方法
 +
 +```
 +$ git config --list
 +```
 +
 +- git の通信方法の変更
 +
 +```
 +$ git remote set-url origin <sshのurl(git@github.com:<ユーザ名>/<リポジトリ名>.git)>
 +```
 +
 +sshキーの生成~登録までは下記のサイトを参照
 +
 +[[https://m-kenomemo.com/ssh-github/|GitHubにSSHで接続する方法【Git/GitHub】 | えむ家のメモ帳]]
 +
 +
 +### GUI
 +
 +##### 脆弱性対応
 +
 +[[https://qiita.com/elfincafe/items/dd0f8793113f0437f078|Git で "fatal: unsafe repository" エラーが出たときの解消法 - Qiita]]
 +
 +[[https://stackoverflow.com/questions/71901632/fatal-error-unsafe-repository-home-repon-is-owned-by-someone-else|git-致命的なエラー「安全でないリポジトリ('/ home / repon'は他の誰かが所有しています)」-スタックオーバーフロー]]
 +
 +**「fatal: unsafe repository・・・」** というエラーが、Gitを操作すると出力される。
 +
 +Git ver2.35 からの脆弱性対応によるものらしい。
 +
 +解決方法は、下記のコマンドをWindowsのPowerShellで実行すればよい。
 +
 +```
 +> git config --global --add safe.directory *
 +```
 +
 +実行すると、「C:\Users\<ユーザ名>\.gitconfig」に下記の設定が保存される。
 +
 +```
 +[safe]
 + directory = *
 +```
 +
 +### リポジトリアクセス時のエラー
 +
 +参考:[GitHubのリポジトリにアクセス時に「remote: Support for password authentication was removed on August 13, 2021.」エラー - キリウ君が読まないノート](https://note.kiriukun.com/entry/20210904-github-password-authentication-was-removed)
 +
 +```
 +remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead.
 +```
 +
 +2021年8月以降、GitHubのリポジトリにアクセスするにはユーザとパスワードのほかに、**アクセストークン**が必要になった。
 +
 +##### アクセストークンの取得
 +
 +GitHubにログインして、
 +
 +「Settings」→「Developer settings」→「Personal access tokens」→「Generate new token」
 +
 +で生成する。
 +
 +生成時にアクセストークンが表示されるが、再度表示することはできないので、どこかにメモしておくこと。
 +
 +##### アクセストークンの使い方
 +
 +クローンする場合
 +```
 +$ git clone https://<アクセストークン>@<リポジトリURL>
 +```
  
  • Git/GitHub.1639314968.txt.gz
  • 最終更新: 2025/04/12 05:15
  • (外部編集)