代码版本控制是作为程序员,必须要考虑的问题,针对Rstudio
可以利用Github
进行版本控,下面对整个操作过程进行说明:
在windows
系统下,选择Tools
--> Global Options
,然后选择Git/SVN
,选择Git executable
,所以安装前提是你要有先安装Git
,如下图所示
选择git目录
然后Create RSA Key
打开Tools
,选择shell
,输入命令:
git config --global user.email "[email protected]
git config --global user.name "yourname"
ssh -T [email protected]
使用GitHub
上的名字
新建一个工程,选择New Directory
新建工程
然后勾选Create a git repository
创建Git
这个时候Rstudio
会出现git
栏,提交到本地,只需要在git
栏下面点击commit
,即可提交至本地
可以将代码保存至GitHub
上,并且创建分支,在GitHub
上创建一个New respository
,命名为test
GitHUb上创建
打开Rstudio
中的Shell
窗口,输入git
命令
git remote rm origin
git remote add origin https://github.com/cystone/advancedSingleCell.git
git config remote.origin.url git@github.com:cystone/advancedSingleCell.git
git pull origin master
git push origin master
将origin
重新定向
git remote set-url origin https://github.com/chengfeifan/test.git
首先在Rstudio
上新建一个project
,选择version control
,然后选Clone Git Respository
,将GitHub
上repository
的url
加入到选项中
Paste_Image.png
然后在shell
窗口输入
git config remote.origin.url [email protected]:ewenharrison/test.git
在git
的时候,我们会建立许多有特性的分支,建立分支的时候,如何使得远端也出现分支,需要用到下面的命令:
git push --set-upstream origin master
$git push fatal: unable to access 'https://github.com/cystone/advancedSingleCell.git/': LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443
git config --global --unset http.proxy
git config --global http.sslVerify false
如果有如下: Enter passphrase for key '~/.ssh/id_rsa':
ssh-add ~/.ssh/id_rsa