git

How to push git reposiotry to multiple hosts

txt

First, add new remote server

1
git remote add gl [email protected]:USERNAME/PROJECT.git

Second, push to multiple servers

1
2
3
4
git add .
git commit -m "m"
git push (This pushes to origin)
git push gl master

Third, if want to add multiple SSH keys, can do it this way:

1
nano ~/.ssh/config:
1
2
3
4
5
6
Host gitlab.com
HostName gitlab.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/gitsync/id
Host github.com
......
Share