1 协作开发
我们将要使用git版本控制系统在多台机器上实现协作开发;
使用私有repo来进行项目的线上同步;
2 新建项目repo
这里我们使用PyCharm直接进行版本控制的操作,首先需要在PyCharm上添加我们的GitHub账户,操作路径:File → Settings → Version Control → GitHub;
3 Clone项目repo
这里使用PyCharm提供的Git支持组件直接从我们的账号中clone已有的项目,
操作路径:VCS → Get from Version Control… → GitHub (user_name);
其示意图如下:
3.2 问题备忘
从GitHub上clone项目时,出现“git: OpenSSL SSL_read: Connection was reset, errno 10054”
git -c credential.helper= -c core.quotepath=false -c log.showSignature=false clone --progress --recurse-submodules https://github.com/…/…git – Python_Git_test
Cloning into ‘Python_Git_test’…
fatal: unable to access ‘https://github.com/…/Python_Git_test.git/’: Operation timed out after 300005 milliseconds with 0 out of 0 bytes received
这个错误是由于git在连接VCS服务器时出现了超时的现象,所以为了解决这个问题,我们可以调整IDE与GitHub连接的等待时间,
操作路径:File → Settings → Version Control → GitHub;
将 Connection timeout加倍,直到可以成功clone为止;
[Log]: 2020.5.5 在Win10上将 Connection timeout设置为21,则可以clone成功。
4 同步代码
4.2 问题备忘
已经将文件加入到.gitignore,但是commit时仍然出现文件
这是因为修改后的文件,已经被加入到缓存去中,需要删掉这些文件的缓存:
git rm -r --cached $absolute_subfolder_path
这里我们也看看cached
字段的含义:
–cached
Use this option to unstage and remove paths only from the index. Working tree files, whether modified or not, will be left alone. (仅删除文件路径的索引,原始工作文件则会被保留)
2 查看repo
查看commit的时间轴
点击repo文件列表右侧的时间轴按钮
就可以看到最近commits的时间轴信息了;