惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

S
Secure Thoughts
罗磊的独立博客
T
The Blog of Author Tim Ferriss
人人都是产品经理
人人都是产品经理
博客园 - 叶小钗
Last Week in AI
Last Week in AI
美团技术团队
Google Online Security Blog
Google Online Security Blog
Application and Cybersecurity Blog
Application and Cybersecurity Blog
D
Docker
G
Google Developers Blog
大猫的无限游戏
大猫的无限游戏
酷 壳 – CoolShell
酷 壳 – CoolShell
小众软件
小众软件
月光博客
月光博客
L
LINUX DO - 最新话题
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
W
WeLiveSecurity
H
Heimdal Security Blog
Vercel News
Vercel News
SecWiki News
SecWiki News
Forbes - Security
Forbes - Security
Blog — PlanetScale
Blog — PlanetScale
Google DeepMind News
Google DeepMind News
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
www.infosecurity-magazine.com
www.infosecurity-magazine.com
TaoSecurity Blog
TaoSecurity Blog
T
Troy Hunt's Blog
A
About on SuperTechFans
C
Check Point Blog
S
Security Affairs
Hacker News - Newest:
Hacker News - Newest: "LLM"
AI
AI
WordPress大学
WordPress大学
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Help Net Security
Help Net Security
博客园_首页
The Last Watchdog
The Last Watchdog
S
SegmentFault 最新的问题
Hugging Face - Blog
Hugging Face - Blog
Security Archives - TechRepublic
Security Archives - TechRepublic
Engineering at Meta
Engineering at Meta
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
I
Intezer
K
Kaspersky official blog
M
MIT News - Artificial intelligence
J
Java Code Geeks
G
GRAHAM CLULEY
P
Palo Alto Networks Blog

Rat's Blog - github

Linux VPS定时备份服务器/网站数据到Github私人仓库 - Rat's Blog 使用github gist api搭建一个动态的个性化博客 - Rat's Blog
Linux VPS将本地脚本代码或文件推送到Github教程 - Rat's Blog
博主: Rat's · 2018-05-08 · via Rat's Blog - github

说明:我们有时候需要将一些脚本代码或者文件上传到Github托管,而Github客户端有点难用,在网页上上传又慢,所以我们需要另想办法,这里就说下在VPS上直接将文件推送到Github方法,而且速度很快。如果你可以建立私人项目,还可以用来备份网站等私密文件。

方法

1、配置Git SSH密钥

ssh-keygen -t rsa

连续按几次Enter,这时候会在/root/.ssh文件夹生成2ssh密钥,然后我们查看并复制公钥id_rsa.pub

cat /root/.ssh/id_rsa.pub

复制好了后,登录Github,进入https://github.com/settings/ssh/newTitle随便填,然后Key填入刚刚复制的密匙点击Add SSH Key添加即可。
请输入图片描述

2、推送文件
首先我们需要进入https://github.com/new,新建一个项目用来存放文件,如果你想将网站等私密文件放在Github,新建项目的时候,选择Private建立私人项目,反之选择Public
请输入图片描述

然后开始配置,如果我们需要推送的文件在网站/home文件夹,这时候运行命令:

#进入文件夹
cd /home
#建立本地仓库
git init
#关联到Github仓库
git remote add origin git@github.com:MOERATS/TEST.git

关联仓库的时候,后面可以用HTTPS链接也可以用SSH,这里建议选择SSH
请输入图片描述

接下来在/home文件夹里,继续操作。

#把目录下所有文件更改状况提交到暂存区
git add -A
#提交更改的说明
git commit -m "push"
#开始推送到Github
git push -u origin master

这时候打开项目地址就可以看到推送的文件了。
请输入图片描述
如果我们推送的文件在修改后再次推送同步的话,就需要从提交暂存区步骤开始。


版权声明:本文为原创文章,版权归 Rat's Blog 所有,转载请注明出处!

本文链接:https://www.moerats.com/archives/618/

如教程需要更新,或者相关链接出现404,可以在文章下面评论留言。