Git-How do I enter a password each time I pull/upload?

Source: Internet
Author: User

Background:

The first two days, the whim, to the computer C disk clean up, halfway also manually deleted some I do not understand the small files, just for their own view of the time can be comfortable; today, open git, want to pull the file, dumbfounded, did not need to enter the user name and password, but now pop out to remind me, very glaring , as if in the irony of my disorderly deletion of documents of obsessive-compulsive disorder

Then, I have a variety of Baidu solutions, some are really complex, look at the mood is not, one of the methods are relatively simple, try to solve the problem successfully, hereby record my resolution process.


Business:

1. Add System Environment variables

Right-click My Computer, select Properties, advanced system settings, and environment variables, system variables---New variable name: HOME; variable value:%USERPROFILE%

Supplemental Description:%USERPROFILE% is to get the current user path under Windows, for example: C:\Users\Witon, the last Witon is the native user name.



2. Create a git user name and password store file (Windows)

My computer is a Windows system, so I've only tried this situation.

Create a new _netrc file under%userprofile%, the C:\Users\Witon path (Linux or Mac creates a new. netrc file, so you can try it yourself)


The contents of the file are as follows:

Machine xxx.xx
Login LoginName
Password Password

The red ones are replaced by the three of their real git domain name, login name, and login password.


3. After the new file is completed, restart Git, it can be pulled normally, and no need to enter the user name and password again yo ~


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.