参考网址:
https://git-scm.com/book/zh/v2/Git-基础-远程仓库的使用
https://blog.csdn.net/g1036583997/article/details/50532651
https://blog.csdn.net/qianxuedegushi/article/details/80311358
https://www.jianshu.com/p/4d642a42414a

1.从Github远端仓库中克隆到本地
以我自己的Github为例,使用git clone克隆pantheon仓库

git clone https://github.com/zzzzk12345/pantheon

这样在本地上当前文件夹内得到仓库的克隆

2.查看本地服务器的名称

最少会有origin的选项,这个是Git给我们分配的仓库服务器的默认名字
3.本地更改
添加test.py文件(随便什么其他的都可以)

touch test.py

4.推送到服务器
这时我们需要使用git add(添加文件到track中),git commit(添加提交时的注释信息), git push(推送到github)

因为我们是添加文件,所以如果不进行add操作,则会报没有track的错误


git status 列出当前目录所有还没有被git管理的文件和被git管理且被修改但还未提交

可以看到有提示使用git add

git add test.py

这时再使用commit进行注释


成功添加注释
最后使用git push到服务器中
git push 的命令格式如下
git push [remote-name] [branch-name]
其中remote name指的是我们本地的名称,也就是git remote看到的origin,branch name也可以在本地进行查看

所以我们输入

git push origin master


结果如下图:

成功添加
5.删除时同添加步骤

另外如果如要配置git的config信息,语法如下,Your Name和email部分自由发挥

git config --global user.name "Your Name"

git config --global user.email "you@email.com"