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]#