https://www.cnblogs.com/cxk1995/p/5800196.html
预置条件:注册了一个github账号,且还在上面创建了一个仓库。
git 正确安装
步骤:从github上将远程仓库拷贝下来
zhufei@SilverRiver:~/zftest$ git clone https://github.com/zhufei2007fang/hello-world.git
正克隆到 'hello-world'...
remote: Counting objects: 7, done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 7 (delta 0), reused 0 (delta 0), pack-reused 0
展开对象中: 100% (7/7), 完成.
在拷贝下来的hello-world目录中创建一个test.html
zhufei@SilverRiver:~/zftest$ cd hello-world/
zhufei@SilverRiver:~/zftest/hello-world$ ll
总用量 16
drwxr-xr-x 3 zhufei zhufei 4096 6月 25 23:16 ./
drwxr-xr-x 3 zhufei zhufei 4096 6月 25 23:16 ../
drwxr-xr-x 8 zhufei zhufei 4096 6月 25 23:16 .git/
-rw-r--r-- 1 zhufei zhufei 57 6月 25 23:16 README.md
zhufei@SilverRiver:~/zftest/hello-world$ touch test.html
zhufei@SilverRiver:~/zftest/hello-world$ ll
总用量 16
drwxr-xr-x 3 zhufei zhufei 4096 6月 25 23:16 ./
drwxr-xr-x 3 zhufei zhufei 4096 6月 25 23:16 ../
drwxr-xr-x 8 zhufei zhufei 4096 6月 25 23:16 .git/
-rw-r--r-- 1 zhufei zhufei 57 6月 25 23:16 README.md
-rw-r--r-- 1 zhufei zhufei 0 6月 25 23:16 test.html
zhufei@SilverRiver:~/zftest/hello-world$ git add test.html
zhufei@SilverRiver:~/zftest/hello-world$ git commit -m "zf commit test.html"
[master 37697c0] zf commit test.html
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 test.html
zhufei@SilverRiver:~/zftest/hello-world$ git push -u origin master
Username for 'https://github.com': zhufei2007fang
Password for 'https://zhufei2007fang@github.com':
对象计数中: 3, 完成.
Delta compression using up to 4 threads.
压缩对象中: 100% (2/2), 完成.
写入对象中: 100% (3/3), 276 bytes | 276.00 KiB/s, 完成.
Total 3 (delta 0), reused 0 (delta 0)
To https://github.com/zhufei2007fang/hello-world.git
a2e1fc3..37697c0 master -> master
分支 'master' 设置为跟踪来自 'origin' 的远程分支 'master'。
git add . (注:别忘记后面的.,此操作是把hello-world文件夹下面的文件都添加进来)
git commit -m "提交信息" (注:“提交信息”里面换成你需要,如“first commit”)
git push -u origin master (注:此操作目的是把本地仓库push到github上面,此步骤需要你输入github帐号和密码)