Automatically save user name and password under git command line

Source: Internet
Author: User

Introduction: Git is a very popular version management tool, based on the client git a lot of, such as tortoise git, Smart git, etc., many times, we still have to be based on the command line for GIT operations, each need to enter a username and password, very inconvenient, How to do the pull and push operation without entering a username and password?

1. Under the LINUX/MAC system

Create a new ~/.netrc file, and record the GIT server, username, and password in this file as follows:

Machine your-git-server
login your-username
password Your-password

If there are more than one server to repeat the above three lines, enter the corresponding server, user name and password can be;

~ Indicates the directory of the head of household, if your username is Wangwu, then the corresponding directory is/USERS/WANGWU.

2. Windows

2. Windows System

On the Windows platform, a little bit of trouble, but also can be implemented, you need to add a user variable%home%, as follows:


Next, create a new file named _netrc in the directory that the%home% variable points to, as shown above, and record the GIT server, username, and password in this file as follows:

Machine your-git-server
login your-username
password Your-password

With the Netrc file, you don't have to enter your username and password when you use Git. 3. Eclipse settings

Configured under the preference--> git--> configuration:

User name and password can also be entered automatically here.

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.