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

推荐订阅源

酷 壳 – CoolShell
酷 壳 – CoolShell
T
Threatpost
Latest news
Latest news
N
News | PayPal Newsroom
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Help Net Security
Help Net Security
D
Darknet – Hacking Tools, Hacker News & Cyber Security
AI
AI
Simon Willison's Weblog
Simon Willison's Weblog
TaoSecurity Blog
TaoSecurity Blog
The Last Watchdog
The Last Watchdog
L
LINUX DO - 热门话题
Google DeepMind News
Google DeepMind News
T
Threat Research - Cisco Blogs
O
OpenAI News
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
T
The Exploit Database - CXSecurity.com
NISL@THU
NISL@THU
Application and Cybersecurity Blog
Application and Cybersecurity Blog
S
Securelist
小众软件
小众软件
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Martin Fowler
Martin Fowler
S
SegmentFault 最新的问题
Cisco Talos Blog
Cisco Talos Blog
云风的 BLOG
云风的 BLOG
AWS News Blog
AWS News Blog
GbyAI
GbyAI
N
News and Events Feed by Topic
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
美团技术团队
Engineering at Meta
Engineering at Meta
A
About on SuperTechFans
博客园 - 三生石上(FineUI控件)
S
Schneier on Security
博客园 - 聂微东
V2EX - 技术
V2EX - 技术
T
Troy Hunt's Blog
SecWiki News
SecWiki News
S
Secure Thoughts
B
Blog RSS Feed
Hugging Face - Blog
Hugging Face - Blog
WordPress大学
WordPress大学
腾讯CDC
H
Heimdal Security Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Apple Machine Learning Research
Apple Machine Learning Research
月光博客
月光博客
www.infosecurity-magazine.com
www.infosecurity-magazine.com
P
Privacy International News Feed

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,可以在文章下面评论留言。