linux下git备份home目录到远程仓库

在/home/用户名 这个目录下存放着我们的大量配置文件。尤其是系统的一些配置i,还有一些个别软件的配置。

# 先创建远程私有库和token key

过程略

# 配置过滤文件 .gitignore

.gitignore

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
# 修改后需要执行下面命令清理缓存
# git rm -r --cached .
/.cache
/Downloads
/下载
/.mozilla
/.config/electronic-wechat
/.config/icalingua
/.config/QQ
/.local/share/logs
/golang/webdavgo/.git
/golang/webdavgo/bin
/.gocache
/golang/ole/
/.local/share/code-server/logs
vscode.lock
code-server-stdout.log
/.local/share/fish/fish_history

# 处理git 这样嗯里 git.sh

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20

# 定义源 git remote set-url origin https://joyanhui:XXX@github.com/joyanhui/XXXX.git
# 修改 .gitignore 后需要清理缓存
# 

#git init
#git rm -r --cached .

git add .
git commit -m "sh git.sh 自动 $(date "+%Y-%m-%d %H:%M:%S")  -$RANDOM"
# 挂代理
export http_proxy="10.0.0.1:20172"
export https_proxy="10.0.0.1:20172"

# git remote add origin  https://joyanhui:XXX@github.com/joyanhui/XXXX.git
# git remote set-url origin https://joyanhui:XXX@github.com/joyanhui/XXXX.git

# git pull --rebase origin master
# 强制覆盖 git push -f origin  master
git push -u origin  master
Licensed under CC BY-NC-SA 4.0
comments powered by Disqus
使用 Hugo 构建
主题 StackJimmy 设计