如何把本地git仓库的内容推送到GitHub仓库

1 在github创建仓库

登录github官网
点击New repository新建远程仓库
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
创建成功后拷贝ssh协议类型的git地址

2 创建本地仓库并推送到github仓库

Shell页面推送过程演示如下

[root@CSDN /home/Sudley/Python/txt2html]#git init
Initialized empty Git repository in /home/Sudley/Python/txt2html/.git/
[root@CSDN /home/Sudley/Python/txt2html]#echo "# 添加支持txt文件转换为html文件的python工具" >> README.md
[root@CSDN /home/Sudley/Python/txt2html]#git add README.md
[root@CSDN /home/Sudley/Python/txt2html]#git commit -m "添加 README.md 文件"
[master (root-commit) 1b5a77c] 添加 README.md 文件
 1 file changed, 1 insertion(+)
 create mode 100644 README.md
[root@CSDN /home/Sudley/Python/txt2html]#git remote add origin git@github.com:Sudley/txt2html.git
[root@CSDN /home/Sudley/Python/txt2html]#git push -u origin master
Warning: Permanently added the RSA host key for IP address '52.74.223.119' to the list of known hosts.
Counting objects: 3, done.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 290 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To git@github.com:Sudley/txt2html.git
 * [new branch]      master -> master
Branch master set up to track remote branch master from origin.
[root@CSDN /home/Sudley/Python/txt2html]#

返回github页面刷新code栏发现README.md文件已上传成功
在这里插入图片描述
上传其他文件到远程仓

[root@CSDN /home/Sudley/Python/txt2html]#git status
# On branch master
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#       handlers.py
#       markup.py
#       rules.py
#       test_input.txt
#       util.py
nothing added to commit but untracked files present (use "git add" to track)
[root@CSDN /home/Sudley/Python/txt2html]#git add .
[root@CSDN /home/Sudley/Python/txt2html]#git status -s
A  handlers.py
A  markup.py
A  rules.py
A  test_input.txt
A  util.py
[root@CSDN /home/Sudley/Python/txt2html]#git commit -m "上传markup.py及其相关模块"
[master d920a1c] 上传markup.py及其相关模块
 5 files changed, 305 insertions(+)
 create mode 100644 handlers.py
 create mode 100644 markup.py
 create mode 100644 rules.py
 create mode 100644 test_input.txt
 create mode 100644 util.py
[root@CSDN /home/Sudley/Python/txt2html]#git push origin
Counting objects: 8, done.
Compressing objects: 100% (7/7), done.
Writing objects: 100% (7/7), 3.66 KiB | 0 bytes/s, done.
Total 7 (delta 0), reused 0 (delta 0)
To git@github.com:Sudley/txt2html.git
   1b5a77c..d920a1c  master -> master
[root@CSDN /home/Sudley/Python/txt2html]#
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值