Version 5 vs 9
Version 5 vs 9
Edits
Edits
- Edit by • rezzonico, Version 9
- Oct 31 2016 11:26
- Edit by • rezzonico, Version 5
- Oct 31 2016 10:51
Edit Older Version 5... | Edit Current Version 9... |
Content Changes
Content Changes
We will explain here 2 use cases:
- [[ https://c4science.ch/w/c4science/rstudio/#you-use-r-or-rstudio-but | You use R or Rstudio but no projects, you are already versioning your work but no integration from within Rstudio ]]
- [[ https://c4science.ch/w/c4science/rstudio/#setting-up-from-scratch | You want to set up an Rstudio project on c4science from scratch ]]
[[ https://c4science.ch/w/c4science/sshkeys/ | Both use cases need SSH keys to be already set up. ]]
# You use R or Rstudio but no projects, you are already versioning your work but no integration from within Rstudio.
While working on Rstudio on your files, associate your work with a project with the New Project dialog: `File -> New project`
and choose `Existing directory`
Choose the directory (if you launched Rstudio from it it should be already there) and `Create project`. This, in pracctice, will create an .Rproj file and modify your .gitignore (check it out with git diff .gitignore)
The system is smart enough to detect if you are using Git. On the bar, you should see a small "Git" icon.
{F230285}
From the Git icon, you can do all the common Git operations you would do on the command line.
## Committing
If you choose `Git -> commit...`, you will be presented with the "Review Changes" panel, which is pretty straightforward. You tick the files you want to "Add", add a commit message and click commit. Once this is done, you can click on "Push".
# Setting up from scratch
You first need to create a repository on C4science.
From within Rstudio, you create a new project with `File -> New Project`, choose `New directory`. You then have to pick the type of Project (standard, package, shiny). If you are familiar with R, you'll know what to choose. If you're not, choose `Empty Project`. Choose a directory name etc and tick the `Create a git repository` box.
What you have done here included a `git init` on the Rproject folder. You should now see a Git symbol on the toolbar.
{F230285}
You can now work on your files and commit, but you need to add an origin to be able to push to c4science: type the following on your command line, from within the R Project directory:
```
git remote add origin ssh://git@c4science.ch/diffusion/997/simplegitrepo.git
git push --set-upstream origin master
```
Change the `ssh://` URL to whatever is your repo's URL. Now you can push your commits to C4science.
We will explain here 2 use cases:
- [[ https://c4science.ch/w/c4science/rstudio/#you-use-r-or-rstudio-but | You use R or Rstudio but no projects, you are already versioning your work but no integration from within Rstudio ]]
- [[ https://c4science.ch/w/c4science/rstudio/#setting-up-from-scratch | You want to set up an Rstudio project on c4science from scratch ]]
- [[ https://c4science.ch/w/c4science/rstudio/#clone-a-repository-from | Clone a repository on c4science from within Rstudio ]]
[[ https://c4science.ch/w/c4science/sshkeys/ | Both use cases need SSH keys to be already set up. ]]
# You use R or Rstudio but no projects, you are already versioning your work but no integration from within Rstudio.
While working on Rstudio on your files, associate your work with a project with the New Project dialog: `File -> New project`
and choose `Existing directory`
Choose the directory (if you launched Rstudio from it it should be already there) and `Create project`. This, in pracctice, will create an .Rproj file and modify your .gitignore (check it out with git diff .gitignore)
The system is smart enough to detect if you are using Git. On the bar, you should see a small "Git" icon.
{F230285}
From the Git icon, you can do all the common Git operations you would do on the command line.
### Committing
If you choose `Git -> commit...`, you will be presented with the "Review Changes" panel, which is pretty straightforward. You tick the files you want to "Add", add a commit message and click commit. Once this is done, you can click on "Push".
# Setting up from scratch
[[ https://c4science.ch/w/c4science/simplerepo/ | You first need to create a repository on C4science]].
From within Rstudio, you create a new project with `File -> New Project`, choose `New directory`. You then have to pick the type of Project (standard, package, shiny). If you are familiar with R, you'll know what to choose. If you're not, choose `Empty Project`. Choose a directory name etc and tick the `Create a git repository` box.
What you have done here included a `git init` on the Rproject folder. You should now see a Git symbol on the toolbar.
{F230285}
You can now work on your files and commit, but you need to add an origin to be able to push to c4science: from Rstudio, lauch a shell via `Tools -> Shell` and type the following:
```
git config --global user.email "YOUR@EMAIL"
git config --global user.name "C4SCIENCE_USERNAME"
git remote add origin ssh://git@c4science.ch/diffusion/997/simplegitrepo.git
git push --set-upstream origin master
```
Change the email and the username to yours and `ssh://` URL to whatever is your repo's URL. Now you can push your commits to C4science.
# Clone a repository from c4science
In RStudio, click `New project` as normal. Choose `Version Control`. Then, pick Git or SVN. Then, enter the repo data. Rstudio will clone the project into the chosen directory and, if needed, create an `.Rproj` file. You're now good to go with Rstudio and c4science. You can use the Git menu and commit + push from within Rstudio.
We will explain here 2 use cases:
- [[ https://c4science.ch/w/c4science/rstudio/#you-use-r-or-rstudio-but | You use R or Rstudio but no projects, you are already versioning your work but no integration from within Rstudio ]]
- [[ https://c4science.ch/w/c4science/rstudio/#setting-up-from-scratch | You want to set up an Rstudio project on c4science from scratch ]]
- [[ https://c4science.ch/w/c4science/rstudio/#clone-a-repository-from | Clone a repository on c4science from within Rstudio ]]
[[ https://c4science.ch/w/c4science/sshkeys/ | Both use cases need SSH keys to be already set up. ]]
# You use R or Rstudio but no projects, you are already versioning your work but no integration from within Rstudio.
While working on Rstudio on your files, associate your work with a project with the New Project dialog: `File -> New project`
and choose `Existing directory`
Choose the directory (if you launched Rstudio from it it should be already there) and `Create project`. This, in pracctice, will create an .Rproj file and modify your .gitignore (check it out with git diff .gitignore)
The system is smart enough to detect if you are using Git. On the bar, you should see a small "Git" icon.
{F230285}
From the Git icon, you can do all the common Git operations you would do on the command line.
### Committing
If you choose `Git -> commit...`, you will be presented with the "Review Changes" panel, which is pretty straightforward. You tick the files you want to "Add", add a commit message and click commit. Once this is done, you can click on "Push".
# Setting up from scratch
[[ https://c4science.ch/w/c4science/simplerepo/ | You first need to create a repository on C4science]].
From within Rstudio, you create a new project with `File -> New Project`, choose `New directory`. You then have to pick the type of Project (standard, package, shiny). If you are familiar with R, you'll know what to choose. If you're not, choose `Empty Project`. Choose a directory name etc and tick the `Create a git repository` box.
What you have done here included a `git init` on the Rproject folder. You should now see a Git symbol on the toolbar.
{F230285}
You can now work on your files and commit, but you need to add an origin to be able to push to c4science: type the following on your command linefrom Rstudio, from within the R Project directory:lauch a shell via `Tools -> Shell` and type the following:
```
git config --global user.email "YOUR@EMAIL"
git config --global user.name "C4SCIENCE_USERNAME"
git remote add origin ssh://git@c4science.ch/diffusion/997/simplegitrepo.git
git push --set-upstream origin master
```
Change the email and the username to yours and `ssh://` URL to whatever is your repo's URL. Now you can push your commits to C4science.
Change the `ssh://` URL to whatever is your# Clone a repo's URL. Now you can push your commits to Csitory from c4science.
In RStudio, click `New project` as normal. Choose `Version Control`. Then, pick Git or SVN. Then, enter the repo data. Rstudio will clone the project into the chosen directory and, if needed, create an `.Rproj` file. You're now good to go with Rstudio and c4science. You can use the Git menu and commit + push from within Rstudio.
c4science · Help