GIT HTTP method password-free pull, push

Note that this is the HTTP method without password, not the SSH method.

Please see another blog for the SSH method: https://my.oschina.net/u/3477605/blog/1806151

 

Description: %HOME%, usually C:\users\Administrator, or it can be the system user name directory created by yourself, anyway, it is in C:\users\

1. Under Windows:

You need to create a .git-credentials file. Since it is not allowed to directly create files starting with "." in Windows, you need to use git bash to do it. The steps are as follows:

1. Open the git bash client and enter the %HOME% directory (ie C:\users\ own computer user name, usually C:\users\Administrator)

2. Create the file .git-credentials with touch.

3. After touch creates the file, use vim to open and edit the file, the command is as follows:

 

打开并编辑:vim .git-credentials(i-进入编辑模式)
Edited content: https://{username}:{password}@github.com (login account, email and password)
Save edits: press <ESC> to exit edit mode, :wq <Enter> to save and exit

4. After execution

git config --global credential.helper store

Open the .gitconfig file in the %HOME% directory, and you will find the following:

[credential]
helper = store

After the above configuration is complete, close git bash and reopen it. After pulling a project, you still need to enter the user name and password for the first time. After the pull is successful, you don't need to enter the user name and password for pull and push in the future. After that, open the new one. The .git-credentials file found a similar text above https://{username}:{password}@github.com.

It can also be configured by adding environment variables under local Windows.

Reference URL: http://www.cnblogs.com/ballwql/p/3462104.html

 

 

2. Method under Linux or Mac:

The basic steps are similar to the above, that is, the .git-credential file can be created directly under linux. The command is as follows:

 

Create a file, enter the file, enter the content:

cd ~
touch .git-credentials
vim .git-credentials
https://{username}:{password}@github.com

Type in the terminal:

git config --global credential.helper store

Open the ~/.gitconfig file and you will find one more item:

[credential]
helper = store

 

 

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325213065&siteId=291194637