Solve the problem of entering username and password every time git submits

The operations of Github and Gitee are the same, and the following methods are applicable to both platforms

  1. View the submission method adopted by the current project

    git remote -v

    If it is as shown in the figure below, it means that the https method is used


  2. Modify submission method

    If it is the https method, then delete the original https method and use the ssh method

    git remote rm origin

    Then under the clone/download button of the repository, copy the ssh link: [email protected]:… .git

    git remote add origin ssh链接

    Then check the submission method adopted by the current project, and you will find that it has changed


  3. check public key

    The default public key is stored in the .ssh directory under the user directory

    There are two files, id_rsa and id_rsa.pub, which are the secret key pair of SSH Key, id_rsa is the private key, which cannot be leaked out, and id_rsa.pub is the public key, which can be told to anyone with confidence.

    Just add the public key to the git platform

Guess you like

Origin blog.csdn.net/qq_20493631/article/details/109454242