首页 > 数据分析 > 如何使用DSX 在RStudio中使用版本控制(GitHub) ?

[悬赏]如何使用DSX 在RStudio中使用版本控制(GitHub) ? (已翻译0%)

查看 (210次)
英文原文:How to use version control (GitHub) in RStudio within DSX?
标签: 数据分析
admin 发布于 2018-02-01 13:39:55 (共 1 段, 本文赏金: 7元)
参与翻译(0人): 暂无 默认 | 原文

【待悬赏】 赏金: 7元

Problem: You want to collaborate with your colleagues or other contributors on a project and want to keep versions of your code you develop in RStudio for backup.

With RStudio in DSX, git comes pre-installed in your container and RStudio by default have git and subversion integration available.

Now let’s say you already have project and you want to clone or check out that project, start by creating a new project.

For example:

  1. I forked one of the sample RStudio projects in my GitHub account (but you can choose your own GitHub repository) — https://github.com/rstudio/bookdown-demo to https://github.com/charles2588/bookdown-demo
  2. Then clone this forked project or the master project into DSX’s instance of RStudio so that you can start collaborating with your teammates or other contributors.

Select Version Control.

Select Git since we are working with GitHub.

Go to GitHub and copy the clone repository URL from GitHub repository and enter it in the Clone Git Repository window. Select Create Project.

Enter GitHub username (email) and password:

This will clone the project into your RStudio (creating a local directory and local branch.)

For your private GitHub Repository or Enterprise GitHub it might ask for other authentications like Personal Token.

https://github.ibm.com/charlesgomes/DSXRstudioProjectTest.git

In such cases, you might need to specify personal access token as password.

Now let’s say you create an R script as I did below:

and you want to commit this file.

Before you commit the above created file in branch of the local repository and then push it to branch in remote connected repository, do the following steps:

Go to RStudio Console.

Run this in the RStudio Console, replacing my email with your GitHub email and my full name with your name.

system("git config --global user.email 'charles2588@gmail.com'")
system("git config --global user.name 'Charles Gomes'")

For Enterprise Git:

system("git config --global user.email 'ccgomes@us.ibm.com'")
system("git config --global user.name 'Charles Gomes'")

Once the above global options are set, you are ready to proceed.

Then go to Tools -> Version Control and select Commit.

Given that the below files are new files, it will ask to add them and will let you commit those files. Check the files.

Enter your commit message and then click Commit.

The above will commit to your RStudio local branch.

Now we are ready to push the branch out to GitHub or Git Repository.

Congratulations you have setup your project with Git version control!


GMT+8, 2018-7-23 00:41 , Processed in 0.119360 second(s), 11 queries .