This commit is contained in:
chenyan 2024-02-17 20:51:13 +08:00
parent d512261383
commit e73e3e0373
5 changed files with 80 additions and 3 deletions

View File

@ -17,7 +17,7 @@
<span>
<a href="http://beian.miit.gov.cn" rel="nofollow">闽ICP备17033777号</a>
</span><br><br>
<span>开源地址: https://gitee.com/apihub/feling.net</span>
<span>开源地址: <a href="https://git.apihub.net/APIHUB/feling.net" target="_blank">https://git.apihub.net/APIHUB/feling.net</a></span>
</div>
{% if page.url contains "/pages/" or page.url contains "/rank/" %}
<script>

View File

@ -82,7 +82,7 @@
<span>
<a href="http://beian.miit.gov.cn" rel="nofollow">闽ICP备17033777号</a>
</span><br><br>
<span>开源地址: https://gitee.com/apihub/feling.net</span>
<span>开源地址: <a href="https://git.apihub.net/APIHUB/feling.net" target="_blank">https://git.apihub.net/APIHUB/feling.net</a></span>
</div>
{% if page.url contains "/pages/" or page.url contains "/rank/" %}
<script>

View File

@ -27,3 +27,33 @@ tags: [git]
[credential]
helper = store
```
## HTTP仓库 保存账号密码
远程仓库的地址如果不是 ssh 协议, 而是用的 http/https 协议. 默认的行为通常是每次提交/拉取都要输入账号密码. 可以修改配置, 让 git 客户端保存密码, 不用每次都输入.
执行:
```sh
git config --global credential.helper store
```
得到 .gitconfig:
```
[credential]
helper = store
```
密码明文保存在:
```sh
~/.git-credentials
```
* 文章目录
{:toc}

View File

@ -0,0 +1,47 @@
---
layout: pages
title: autossh 不管用怎么办
categories: [配置]
tags: [ssh, autossh]
lastModifiedDate: 2024-02-17
---
## 背景
家里的个人服务器, 需要通过 ssh 连接到香港的云服务器. 但是网络连接不稳定, 经常断连.
尝试过 autossh, 但是用不明白, 没啥效果.
每次使用, 还是需要在服务器上手动连接. 就想着有没有啥迂回的办法, 把这个麻烦解决掉.
写个脚本定时检查吧. n 年前写过的 [python 获取当前网速](/pages/2015/05/project-cur-net-speed.html) 的笔记可以直接拿来抄.
## 上代码
```py
# ssh_recover.py
import os
ps_response = os.popen('ps x | grep ssh').read()
if '1.1.1.1' not in ps_response:
os.popen('ssh root@1.1.1.1 -gD7890')
if 'xxx.com' not in ps_response:
os.popen('ssh root@xxx.com -fgnNC -R1604:127.0.0.1:80')
```
```sh
# crontab -e
* * * * * /usr/bin/python3 /home/xxx/ssh_recover.py
```
* 文章目录
{:toc}

View File

@ -244,7 +244,7 @@
<footer class="uk-grid uk-grid-small" style="background:#f6f6f6;padding: 10px 10px 0 10px;">
<div class="uk-width-small-1-1 uk-width-medium-1-3 uk-text-small uk-text-muted">
<span>
开源地址: https://gitee.com/apihub/feling.net
开源地址: <a href="https://git.apihub.net/APIHUB/feling.net" target="_blank">https://git.apihub.net/APIHUB/feling.net</a>
</span><br><br>
<span>
<a href="http://beian.miit.gov.cn" rel="nofollow">闽ICP备17033777号</a>