[git] Ask me to enter the account password every time I submit

insert image description here
Question: This is because the http protocol
needs to be changed to the ssh protocol

  1. Generate ssh account key
    ssh-keygen -t rsa -b 4096 -C "[email protected]"
    Add the public key to the Git remote server
    Copy your public key content to the SSH public key configuration file of the Git remote server. For specific operation methods, please refer to the documentation of the Git remote server or related tutorials.

Modify the remote address of the local Git warehouse

2. Use the following command to modify the remote address of the local Git warehouse, and replace the original HTTP address with the SSH address:
git remote set-url origin [email protected]:USERNAME/REPOSITORY.git

  1. Push code
    Push code
    Now, you can use the git push command to push the operation. Git will automatically use your SSH key for authentication, after completing an SSH login, you don't need to enter your password again.

It should be noted that in order to protect your Git account and code security, it is recommended to keep the SSH key properly and take necessary security measures. For example, you can set a key passphrase, enable two-factor authentication, and more.

Guess you like

Origin blog.csdn.net/weixin_40293999/article/details/130387791