github本地文件和远端文件的协同
Part 1 从云端下载到本地
这个操作很简单,只需要git clone xxx.git即可。注意,如果是在windows10下,有时候这个指令有可能会失灵,此时要将xxx.git链接里面的https改成git,这样就能顺利clone到本地进行修改了。
git clone user_name/repository_name.git
# 例如
git clone https://github.com/open-mmlab/mmdetection.git
# 在win10下有可能要改成
git clone git://github.com/open-mmlab/mmdetection.git
Part 2 从本地上传到云端
# 前期准备,建立和github remote的联系
ssh -T git@github.com
# 出现类似下面这样的字眼,说明已经成功连上了,其中user_name是连接的github账户的用户名
Hi user_name! You've successfully authenticated, but GitHub does not provide shell access.
# 正式开始,比如要将本地的xxx.py文件上传到云端,那么遵从如下的指令
git add xxx.py
# git commit -m 'description'添加对xxx.py文件的描述
git commit -m 'training code'
# 将xxx.py上传到远端
git push origin main