💭

一時的に別の GitHub ユーザーに切り替えてリポジトリ作成し push するフロー

2022/07/04に公開

毎回忘れているのでメモ。

  1. push したいディレクトリ上で git init する
  2. 一時的に切り替えたい別ユーザーの情報に config を変える
git config --local user.name [別ユーザーのID]
git config --local user.email [別ユーザーのemail]
  1. この状態で git add . && git commit -m "initial commit"
  2. この別ユーザーの GitHub 上で新規 repo 作成
  3. この別ユーザーの GitHub 上で、repo に push 権限のある PAT を作成
  4. 以下を入力
git remote add origin https://[別ユーザーのID]:[別ユーザーのPAT]@github.com/[別ユーザーのID]/[repo名].git
  1. git push origin main

Discussion