Setting Password-Free Access via HTTPS
Background
Prerequisites
- You have to enter the username and password in CodeHub each time you use the HTTPS protocol to perform operations such as git clone, git fetch, git pull, and git push.
Setting Password-Free Access on Windows
The following table describes how to set password-free access on Windows.
Setting Password-Free Access on macOS
Install the osxkeychain tool to implement password-free access.
- Check whether the tool has been installed.
git credential -osxkeychain # Test for the cred helper Usage: git credential -osxkeychain < get|store|erase >
If the following information is displayed, the tool has not been installed.
git: 'credential -osxkeychain' is not a git command. See 'git --help'.
- Obtain the installation package.
git credential -osxkeychain # Test for the cred helper git: 'credential -osxkeychain' is not a git command. See 'git --help'. curl -s -o \ https://github-media-downloads.s3.amazonaws.com/osx/git-credential-osxkeychain # Download the helper chmod u+x git-credential-osxkeychain # Fix the permissions on the file so it can be run
- Install osxkeychain in the directory where Git is installed.
sudo mv git-credential-osxkeychain\ "$(dirname $(which git))/git-credential-osxkeychain" # Move the helper to the path where git is installed Password:[enter your password]
- Use osxkeychain to set Git to the password-free mode.
git config --global credential.helper osxkeychain #Set git to use the osxkeychain credential helper
The password needs to be entered the first time you perform Git operations. After that, osxkeychain will manage the username and password, and you do not need to enter password subsequently.
Setting Password-Free Access on Linux
Linux provides two password-free access modes:
- cache:
- Credentials are cached in memory and cleared after 15 minutes.
git config --global credential.helper cache #Set git to use the credential memory cache
- Set the expiration time in timeout, in units of seconds.
git config --global credential.helper 'cache --timeout=3600' # Set the cache to timeout after 1 hour (setting is in seconds)
- Credentials are cached in memory and cleared after 15 minutes.
- store:
Credentials are stored in a plain-text file (~/.git-credentials by default) in the home directory on the disk. The credentials never expire unless you change the password on the Git server. The content of the git-credentials file is as follows:
https://username:password@***********.com
After saving the credentials in the preceding file, run the following command to implement pass-free access:
git config --global credential.helper store
Troubleshooting
If the message SSL certificate problem: self signed certificate is displayed when you download code using HTTPS, run the following command on the client:
git config --global http.sslVerify false
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot