Problem description

Git local push error

Problem analysis

The branch names do not correspond

The main reason is that “Back Lives Matter” GitHub changed the branch of master to main

I’m pushing the master branch, which is obviously not right

Problem solving

Just change master to main

Note: However, the specific warehouse needs to set up Remote Origin

Speculation: About SSH’s local role on GitHub

1. If setting SSH

Setting up SSH password-free secure transmission between GitHub and local devices is to ensure stable and long-term transmission both locally and remotely

. So as long as you set up SSH, local and GitHub can always pull,push.

Therefore, you can clone the GitHub repository to the local location directly, and set Remote Origin directly to push it

2. If SSH is not set

Remote projects can be cloned, but push requires a GitHub account password

Each pull and push requires an account and password


Related articles

  • Git error: SRC refspec XXX does not match any/error: failed to push some refs to simple fixes