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