- Check out ssh config file (
~/.ssh/config) to see git accounts:
git@github.com:hahn80/project.git => user is hahn80
git@github.texervn:texervn/project.git => user is texervn git clone https://github.com/githubtraining/hellogitworld
cd hellogitworld
git config user.email texervn@email
git config user.name "Texer VN"
git remote set-url origin git@github.texervn:texervn/hellogitworld.git git clone git@github.texervn:texervn/hellogitworld.git
cd hellogitworld cd /path/to/project
git config user.email "hahn80@email"
git config user.name "Hahn 80"
git remote set-url origin git@github.com:hahn80/project.git
git push cd /path/to/project
git init
git config user.email "hahn80@email"
git config user.name "Hahn 80"
git remote set-url origin git@github.com:hahn80/project.git
git add .
git commit -m "Initial commit"
git push --set-upstream origin masterFirst, switch to a right account:
gh auth switchNow, create a repository and clone to local
gh repo create project --add-readme -d "Sample Project" -l MIT --public --clone
cd project
git status
git config user.email
git config user.nameIf we want to create a private repository, just use --private inplace of --public