Git remote server switching operation guide


Recently, I just met the need to switch the local git warehouse to Alibaba cloud git warehouse. I take this opportunity to summarize the GIT related commands.

Git creates user generated SSH key


Git switch remote address code:

#View current remote code

After switching, you can try to submit the code. At this time, some friends will find that their code submission fails, and the report version is backward and cannot be submitted.

At this time, we need to force the submission of code to overwrite the original remote code.

Of course, you must ensure that your code is up-to-date. If something goes wrong, rollback can also recover the loss

git push -f origin master

At this point, the remote address switching is completed. I hope I can help those children in need.


This work adoptsCC agreement, reprint must indicate the author and the link to this article