Git learning Note: Remember to push passwords through https

Source: Internet
Author: User

I just learned some basic git operations yesterday, but unfortunately [email protected] announced that we should try to Use https for operations.
However, when using https for push, you must enter the account and password.

A variety of solutions have been found on the [email protected] official website of Baidu Google, "how to set a password using [email protected] in https mode"
Several methods are provided in this article, which are very simple.

I don't like the cache method very much, because it needs to be set and will expire.
The corresponding store is very convenient. After global settings, it is convenient for multiple databases to use.
Of course, if you have a database that does not use the account password, configure it separately.

Git config credential. helper store

In this way, remove -- Global to configure the user name and password for the current project.

Maybe the first time I used it, my friends didn't quite understand it. I didn't enter the account password clearly. How can I remember it?
In fact, after the configuration is complete, we need to push it once. This time we have to enter the account and password, but we do not need to enter the next push.

As for the finalUser name: PasswordI don't like it very much.
But I also tested it and found a small problem. I 'd like to share it with you.

Git remote add origin http: // yourname: [email protected]/name/Project. Git

This command is fine. But when we add the user name and password, the problem arises.
For example, the username is [email protected] And the password is @ 123456.
Then the address is changed to http ://[Email protected]:123456@ Git.oschina.net/name/project.git
Such an address is completely unavailable. We must encode the user name and password URL.
The User Name ABC % 40qq.com and password % 40123456 are available.

Of course, for jser, converting URLs or something is simple. Press F12 to open the console,
Enter encodeuricomponent ('[email protected]') to obtain the result.

The command behavior we finally get

Git remote add origin http: // ABC % 40qq.com: % [email protected]/name/Project. Git

In this way, we can directly push it without entering the user name ..

Well, today's sharing is all about it. I hope it will help you.

 

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.