Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The method of not entering password every time when git connects with https in Linux

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Preface

Under the command line, we are generally used to using ssh for git operations, but in some cases we can only use the account password when logging in. Every time we need to interact with the git server, such as push, we are prompted to enter the account and password. Often when push and fetch, this operation is quite annoying, so how to save the git password?

In this article, we will introduce two implementation methods. Let's take a look at the detailed introduction.

Method one

First create the. git-credentials under the home directory, and then enter:

Https://{username}:{password}@github.com

If there are multiple, one line at a time,: wq save exit

Then execute the command at the terminal

Git config-global credential.helper store

If we see the following in the ~ / .gitconfig file, it means we are successful.

[credential] helper = store

Method two

This method requires git version > = 1.7.10. Use git version to check the version number to see if it supports it. If you do not support it and want to use it, upgrade the git version yourself.

Execute under the terminal

Git config-global credential.helper cache

The password will be cached for 15 minutes by default. If you want to change it longer, such as 1 hour, then you can

Git config-global credential.helper 'cache-timeout=3600'

The 3600 here refers to seconds. You can change it at other times.

Summary

The above is the whole content of this article, I hope that the content of this article has a certain reference and learning value for your study or work, if you have any questions, you can leave a message and exchange, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report