-
勾选
Add a README file
,这样待会就可以直接克隆了 -
克隆仓库
1
git clone [email protected]:your-username/repo-name.git
-
使用 Bash 脚本自动上传
1 2 3 4
#!/bin/bash git add --all git commit -m "update" git push
-
安装所需软件
1 2
sudo apt install fzf xclip pip3 install pyperclip
-
使用 Python 脚本获取图片网址
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
#!/usr/bin/env python3 import pyperclip import subprocess # 请按照实际情况填写 username = "username" repo_name = "repo-name" branch_name = "branch-name" github = f"https://raw.githubusercontent.com/{username}/{repo_name}/{branch_name}/" jsdeliver = f"https://cdn.jsdelivr.net/gh/{username}/{repo_name}/" copy_path = "fzf | tr -d '\n' | xclip -selection c" def get_url(): subprocess.call(copy_path, shell=True) path = pyperclip.paste() print(f"\n\n") print(f"\n") pyperclip.copy(f"") while True: if input("Press Enter to continue. Type something else to quit: ") == "": get_url() else: break
这个脚本使用会输出图片的原网址和经过 jsDelivr 加速的网址,并把 jsDelivr 的网址复制到剪贴板。
-
私人仓库需要 token 访问图片,但是 token 会自动刷新,刷新后就无法使用之前的网址。参考:图床+Github需求 ↩︎