linux save git account password

Today I'm working on the first version of jenkins, and I encountered a git download that requires an account password every time, so Baidu, use the method, and get it

1. By means of documents

1. Under ~/, touch to create the file .git-credentials, edit this file with vim, and enter the content format:

touch .git-credentials
vim .git-credentials

Press "i" in it and enter:  https: // {username}:{password}@github.com 

For example https://account:[email protected]

2. Execute under the terminal

git config --global credential.helper store

3. You can see the ~/.gitconfig file, there will be one more item:

[credential]
helper = store

4.OK

 

Second, through the cache

Requirements: git version needs to be >= 1.7.10

git config --global credential.helper cache
# The default cache password is 15 minutes, you can change it longer, such as 1 hour
git config --global credential.helper 'cache --timeout=3600'

Guess you like

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