Article Directory
How to submit and push a code to two warehouses at the same time in Git
Git - Push a project from local to GitHub and Gitee at the same time
How to submit and push a piece of code to two warehouses at the same time, you need to specify which warehouse to pull the code from
View warehouse bindings
git remote -v
origin [email protected]:mrathena/code.study/python.apex.weapon.auto.recognize.and.suppress.git (fetch)
origin [email protected]:mrathena/code.study/python.apex.weapon.auto.recognize.and.suppress.git (push)
Then bind another remote warehouse, the warehouse can only push but not pull
git remote set-url --add origin [email protected]:mrathena/python.apex.weapon.auto.recognize.and.suppress.git
git remote -v
origin [email protected]:mrathena/code.study/python.apex.weapon.auto.recognize.and.suppress.git (fetch)
origin [email protected]:mrathena/code.study/python.apex.weapon.auto.recognize.and.suppress.git (push)
origin [email protected]:mrathena/python.apex.weapon.auto.recognize.and.suppress.git (push)
At this time, when the push is executed, there is a high probability that it can only be successfully pushed to the first warehouse, and the warehouse bound later will reject it and ask to obtain it once
You can perform git push -f
a forced push once, and the follow-up git push
will be normal
For other cases, see the reference article
GitHub ssh: connect to host github.com port 22: Connection timed out
If the following content appears during GitHub push, including ssh: connect to host github.com port 22: Connection timed out
the word , it cannot be pushed
ssh: connect to host github.com port 22: Connection timed out
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
First enter ssh -T [email protected]
to check whether the SSH connection is successful. If prompted ssh: connect to host github.com port 22: Connection timed out
, it means that port 22 may really be unavailable. You can use the following method to change to port 443
C:\Users\mrathena\.ssh
Create a new text file inconfig
, the content is as followsHost github.com User GitHub 邮箱 Hostname ssh.github.com PreferredAuthentications publickey IdentityFile ~/.ssh/id_ecdsa # id_rsa 可能已经被 GitHub 封了, 我现在用的是 id_ecdsa Port 443
- Enter again
ssh -T [email protected]
, enter according to the promptyes
,You've successfully authenticated
if the configuration is successfulThe authenticity of host '[ssh.github.com]:443 ([20.205.243.160]:443)' can't be established. ED25519 key fingerprint is SHA256:+DiY3wvvV6TuJJhbpZisF/zLDA0zPMSvHdkr4UvCOqU. This host key is known by the following other names/addresses: C:\Users\mrathena/.ssh/known_hosts:2: github.com Are you sure you want to continue connecting (yes/no/[fingerprint])? yes Warning: Permanently added '[ssh.github.com]:443' (ED25519) to the list of known hosts. Hi mrathena! You've successfully authenticated, but GitHub does not provide shell access.
- push again will succeed