iTranslated by AI
The content below is an AI-generated translation. This is an experimental feature, and may contain errors. View original article
💭
Workflow for temporarily switching GitHub users to create and push a repository
Taking a note here since I always forget.
- Run
git initin the directory you want to push - Change the local config to the information of the other user you want to switch to temporarily
git config --local user.name [Other user's ID]
git config --local user.email [Other user's email]
- In this state, run
git add . && git commit -m "initial commit" - Create a new repository on this other user's GitHub account
- Create a Personal Access Token (PAT) with push permissions for the repository on this other user's GitHub account
- Enter the following
git remote add origin https://[Other user's ID]:[Other user's PAT]@github.com/[Other user's ID]/[repository-name].git
git push origin main
Discussion