create different ssh key for different github accounts (must give filename while creating, else it'll overwrite - ex: ~/.ssh/id_ed25519_suryabigapp)
$ ssh-keygen -t ed25519 -C "[email protected]"
$ ssh-keygen -t ed25519 -C "[email protected]"
for example, 2 keys created at:
~/.ssh/id_ed25519_suryabigapp
~/.ssh/id_ed25519_suryatct
$ cd ~/.ssh/
$ touch config
$ nano config
Then add config for different accounts
#suryabigapp account
Host github.com-suryabigapp
HostName github.com
User git
IdentityFile ~/.ssh/id_ed25519_suryabigapp
#suryatct account
Host github.com-suryatct
HostName github.com
User git
IdentityFile ~/.ssh/id_ed25519_suryatct
Change repo url from HTTPS to SSH Reference and modify your Git config
cd to your project repo folder ex: bigapp-repo
git remote set-url origin [email protected]:bigappcompany/bigapp-repo.git
modify git config for bigapp-repo
$ git config user.name "suryabigapp"
$ git config user.email "[email protected]"
cd to different project repo folder ex: curio-repo
git remote set-url origin [email protected]:curio-com/curio-repo.git
modify git config for curio-repo
$ git config user.name "suryatct"
$ git config user.email "[email protected]"
then use normal flow to push your code
$ git add .
$ git commit -m "your comments"
$ git push