What I did to use git with Rstudio in Ubuntu 16.04

March 27, 2018
By

(This article was first published on R-Analytics, and kindly contributed to R-bloggers)

Before installing anything I signed up on https://github.com/and created my R-ANALYTICS repository:
https://github.com/LaranIkal/R-ANALYTICS
Now the installation and setup.
1. I installed git on Ubuntu, from a terminal window:
$ sudo apt-get update
$ sudo apt-get install git
2.- I configured git:
I did this through the git config command.
I provided my name and email address because git embeds this information into each commit.
Open a terminal and run:
$ git config –global user.name “Your Name” –> This is part of your link: https://github.com/LaranIkal, you see, my name is LaranIkal
$ git config –global user.email “[email protected]
To see all of the configuration items just type:
$ git config –list
As a note, it is saved to a file called ~/.gitconfig in your home folder.
Steps In Rstudio:

1.- Checking/Setting Rstudio right configuration to use Git/SVN: Menu→Tools→Global Options
Select GIT/SVN tab at the end of the below screen shot is the sample.
Now check the values:
My git executable is in:
[email protected]:/usr/bin$ ls -ltr git
-rwxr-xr-x 1 root root 1866896 oct 4 13:22 git
svn is not there but, Rstudio ise setup like that and since I am using git, I do not care about svn.
[email protected]:/usr/bin$ ls -ltr svn

ls: cannot access ‘svn’: No such file or directory
3.- Now I created my project:
on Rstudio go to File→ New Project

The next screen is showed, select Version Control:

Select git on the next screen:

Switch to the browser to get the https address of my project:
Clicking on the small icon

to the right will copy the address to the clipboard.

Now I pasted it to my new project repository URL:
The project directory name was setup automatically after pasting the URL.
The last step was to browse to the folder I wanted to clone my git repository into and clicked Create Project button.

Now I created new files:

Then I committed them: Menu → Tools → Version Control → Commit 

Select the document to be committed, enter a commit message and click the Commit button to the right:

This will commit to the local git repository on the hard drive.
Click close button on the right up side. And close the commit window.
Now it is needed to push the changes to git site.
Open a terminal window in the project local folder, type git push command and press enter:

After pressing enter git asks for user and password and, commit changes:

After this I can see my changes in my git repository on the web browser:
Enjoy it!!!.

Carlos Kassab
https://www.linkedin.com/in/carlos-kassab-48b40743/


More information about R:


https://www.r-bloggers.com

To leave a comment for the author, please follow the link and comment on their blog: R-Analytics.

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.

Search R-bloggers

Sponsors

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)