Commiting to github from R Studio - r

I am trying to create a website using the R package blogdown. Just have a little problem here. After these functions,
library(blogdown)
new_site()
I tried to commit the folders to Github (have a look)
I don't get anything after pressing "Commit". When I try to check the boxes, nothing happens. When I click "Stage", nothing. What's gone wrong?

Your problem has nothing to do with blogdown but it is a GIT issue. From your picture, it seems, that you did not select and check all the boxes for those files you want to stage. This is necessary to tell GIT which files it should include for your commit:
Check those files you want to prepare for the commit. Only those files which are staged will be included in the commit. (This is the action you missed!)
Add a commit message (this you have already done)
Only now you can click the button "Commit" successfully.

The documentation for blogdown is pretty extensive. In particular, I suggest reviewing the quick example here.
You've generated the template for a new site with blogdown::new_site() but you haven't built it without running blogdown::build_site(). Then the public folder that is generated and populated is the thing that should be committed.

Related

Push to Github Stuck on Rstudio

While I am trying to push on GitHUb from rstudio it is stuck and is not reflecting on Github
There might be some mismatch in the settings that I have configured watching tutorials.
Error Screenshot
Git Settings
Rstudio Options
GitHub Account Settings
Repository Settings
I was facing the same issue while following one of the courses online. I don't know exactly what causes this issue.
Problem: Exactly the same with every setting as shown in the screenshot.
The solution:
in RStudio, click on the "Tools" menu and select "Shell"
Run the following command: git push
it might ask you for your git username and password. Supply this
information, make sure it is correct
hopefully, the push is successful, then you can close the window
Now make some more edits to some files so that you have new content to
push
Click on the "push" button in RStudio and this time the push should
work
This is not my solution I found it here: https://stackoverflow.com/a/45804117/5677883

GitHub branch syncing with the master for no obvious reason

I'm coding in Rstudio and my workflow is along these lines:
make a new branch using Rstudio's UI
add some code or fix a bug
commit code when I'm satisfied and push to GitHub
merge the new code into the master on GitHub
pull the latest master code from GitHub into Rstudio using it's UI
delete any local/remote branches via command line (because Rstudio doesn't have the functionality and doesn't sync with GitHub when it comes to remote branch deletion)
This might not be the most efficient way of doing things (I'm new to git) but it works well enough except for the problem I'm having. Twice now, seemingly at random, I've created a new branch, worked on it and when I've gone back to check something in the master they are identical. The code changes I've made in the branch have already synced with the master.
This is what the last two lines of the History look like:
git history
independant_erp_norm_regressions is the last branch I merged into the master while preprocess_select_global_pars is the current branch which is syncing to the master unduly.
I'm at a loss as to what is going on because I'm doing the same thing as I usually do and haven't been able to find any similar questions on stackoverflow.
Any help would be greatly appreciated (as well as any ways in which I can streamline my workflow).
Ok thanks for the responses guys, as per Tim's reply I decided to commit the changes made to the new branch via Rstudio's UI and check in command line to see what happened behind the scenes. (After that I thought I would do an entire branch/merge via command line to see if the problem persisted or if it was a Rstudio bug). So just before committing the changes Rstudio's git interface showed that Master and my branch were still in sync up to and including having staged files selected together. After committing I used "git show-branch" in command line and it showed that only the correct branch had a new commit, this was mirrored in Rstudio's Git history interface and after merging via GitHub all is well. So it seems like it was just an Rstudio-git bug of sorts.

RStudio is slow when loading a project / package in development

I have recently experienced a serious problem with Rstudio when developing a package. Whenever, I open an existing project with Rstudio where versions are controlled with Git, it takes so long for it to respond to any command. It is also impossible to type something in the console (e.g. 1+1) and obtain the result. Even quitting the Rstudio, should be done with task manager. There is no problem when I create a new project / package or when I open directly a R script.
This problem appears both when the project is saved on a dropbox or on a local repository.
To overcome this issue everytime I need to modify my code, I create a new project, and then I move toward the new repository all my current R scripts and the folder ".git".
I would appreciate if anybody could help me with this issue.
I had a similar problem to yours. Changing the attribute of my .git folder into hidden solved my problem.
We recently discovered an issue where projects using git for version control could become laggy / unusable on Windows if the .git folder within the project had become a non-hidden directory.
https://github.com/rstudio/rstudio/issues/1918

Using Git in R-studio: cannot stage modified code files

I am new to using git and currently employ the following combination:
Git-Gui v.0.20
R-studio 0.99.489
R 3.22
Bitbucket code repository
Windows 7
Until recently this combination worked fine for pulling and pushing code to the repository. But now I cannot push modified code anymore nor commit it in R-studio.
In R-studio, modified code is marked by a blue M with a checkbox next to it. I cannot check this box for staging, committing and pushing anymore. It literally does not check and react when I click on it.
When I create a new code sniplet which shows as yellow question mark ? I can check and push it, but modified versions cannot be checked anymore.
I have already deinstalled git and R-studio and re-installed but the problem persists. I also created a new repository but the problem occured in the new repository as well. I am a bit clueless where to start looking for a soluation and a web search did not yield many results except this discussion here, which I cannot fully follow because it perhaps does not apply fully to my problem. In any case when I give
> Sys.which('git')
R returns:
git
""
I would appreciate advice where to go from here.
I found an answer to my question. It is a bug in RStudio, albeit not a very well documented one.
When there is a space in the .R file name, it is not possible to push the file through git. Removing the space solves the problem.
See here for an official comment on the Rstudio board dating February 2015. I am using the most recent version of Rstudio and it is not yet fixed there.
Try if the issue persists with:
the latest git for Windows unzipped anywhere you want: PortableGit-2.6.3-64-bit.7z.exe
its path added to %PATH%:
set PATH=%PATH%;C:\path\to\PortableGit-2.6.3-64-bit\bin
its path declare in R-Studio C:\path\to\PortableGit-2.6.3-64-bit\bin\git.exe
R-Studio itself launched from a CMD session where %PATH% already references git.

Rstudio opens all files in package after build

Every time I build my package after a modification, R studio will display every file in the package as untitled, and I have to close them and reopen them in order to modify files before another build. To be honest, it doesn't affect functionality that much, but is annoying and can sometimes cause Rstudio to crash.
Has anyone seen this before, and can suggest a fix?
I would post a screenshot, but I am new to stackoverflow and don't have enough reputation (10).
I haven't figured out what caused the problem, but I was able to solve it by deleting all the project files produced by Rstudio (.RProj.user, packagename.Rproj, .Rhistory, .Rbuildignore), and then creating a new project in the existing directory.

Resources