Ubuntu如何同步文件到GitHub上

例如,我想把Scraping这个新建的项目同步到github上

第一步 : 在自己的GitHub上建立同名目录
在这里插入图片描述
第二步: ubuntu中进入目标项目或者新建项目

cdd@ubuntu:~/Desktop$ cd Scraping/

第三步: 创建文件README

cdd@ubuntu:~/Desktop/Scraping$ echo "# Scraping" >> README.md

第四步: 初始化git init

cdd@ubuntu:~/Desktop/Scraping$ git init

第五步: 提交文件

cdd@ubuntu:~/Desktop/Scraping$ git add README.md

第六步: 创建commit

cdd@ubuntu:~/Desktop/Scraping$ git commit -m "first commit"

[master (根提交) ffb89d7] first commit
 2 files changed, 1 insertion(+)
 create mode 100644 README.md
 create mode 100644 first_python.py

第七步: 登录账号

cdd@ubuntu:~/Desktop/Scraping$ git branch -M master
cdd@ubuntu:~/Desktop/Scraping$ git remote add origin https://github.com/Jason-cdd/Scraping.git
cdd@ubuntu:~/Desktop/Scraping$ git push -u origin master

这里需要将github目录的链接输入进来,这个链接在github上新建目录时同步生成的,输入账号和密码后就成功了

Username for 'https://github.com': Jason-cdd 
Password for 'https://Jason-cdd@github.com': 
枚举对象: 4, 完成.
对象计数中: 100% (4/4), 完成.
使用 4 个线程进行压缩
压缩对象中: 100% (2/2), 完成.
写入对象中: 100% (4/4), 269 字节 | 134.00 KiB/s, 完成.
总共 4 (差异 0),复用 0 (差异 0)
To https://github.com/Jason-cdd/Scraping.git
 * [new branch]      master -> master
分支 'master' 设置为跟踪来自 'origin' 的远程分支 'master'
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值