How to upload local RStudio Project to Github including commit history? - r

I have a RStudio Project with a history of git commit history.
I would like to upload this Project incl. the git commit history to Github and see the commit history on Github.
I can create a new repo on Github and commit from RStudio, but this would not include
past commits i have locally.
What i tried:
I can upload a RStudio Project / package. But (all?) the git files are in a hidden Folder (OS: Windows 10) and i cant upload this hidden Folder to Github (get a warning / error message "This file is hidden").
Looked through https://happygitwithr.com/rstudio-git-github.html

All you should need would be to:
add an origin to your local repository referencing the new (empty) GitHub repository
push
That is:
git remote add origin https://github.com/<you>/<newRepo>
git push -u origin master
# or
git push --mirror

Add your GitHub url to the remote using the Terminal tab then push. https://articles.assembla.com/en/articles/1136998-how-to-add-a-new-remote-to-your-git-repo

Related

adding version control Git to my already deployed wp website

I have a wordpress website on hostinger and im trying use version control Git on it without downloading the files locally but i have no idea what to do or where to start ! my goal would be pushing to github as if im working locally (but im not the files are on the server and i dont want to download them ) please Help.
You need to initiate a git repo for the files on a server and add a GitHub repo as the remote for this. Then you can push files from your Hostinger server to GitHub. To do this, you will ideally need SSH access to your hosting. This seems possible with Hostinger depending on your hosting plan. See how to login to hostinger account via SSH.
Once you've logged into your hosting account via SSH:
Change into your website's folder using cd /path/to/folder
Start a new git repo in this folder using git init
Add all your existing files using git add .
Commit the files you've added using git commit -m "Commit message"
Create a new repo on GitHub (if you haven't already)
Add the empty GitHub repo as the remote for the files on your server using git remote add origin git#github.com:username/repo-name.git
You should now be able to push files to GitHub using git push origin main or git push origin master
Good day.
Unfortunately you can not push at once from hostinger to Github.
I have 7 steps for you to push all code to the GIT server:
1)Install github locally
Download github
2)Copy the files of your website to local directory
3)Open cmd.exe on windows follow to your catalog with Website files and run next command to initialize new git repository locally
git init
4)Add files to your locall repo
git add .
5)Add commit
git commit -m "First commit of website"
6)Create remote repo link for your website on github.com and copy link to the next command(replace CAPS)
git remote add origin https://github.com/USERNAME/REPO_NAME.git
7)Push all files to Github
git push origin master

Unable to add the git url to connect project in Rstudio with git repository

Im trying to connect an existing project in R studio with an external git repository. I have installed it and verified that there is communication between this and rstudio. Then I
Execute the Project Options command (from the Project menu)
Choose Version Control options
Change the version control system from (None) to Git
Confirm that you wish to initialize a new Git repository
but I cannot put inside the git url as the relative input (Origin) cannot be clicked. Anybody has the same issue? I am following this tutorial.

Local alternate for Git with RStudio?

My colleague & I are starting on a R project, we both would be working simultaneously & interchangeable components of the model we are building. We can not use Git, as we do not want to put our code online, also it is not allowed by the organization. We also do not have a server of our own, what we have is some common shared drive. Is there a way, we can use a tool like Github/SVN completely locally, where both of us can push our code.
There are two options you can manage your R project with git repo.
Option 1: setup remote git repo in the shared directory
You can setup a remote git repo in the shared directory, and then add the remote repo as a remote for your local git repo, then you can push and push from the remote git repo. Detail steps as below:
First, in an empty folder of the shared directory (assume in \\share\path\gitrepo), execute:
git init --bare
Then add the remote repo as a remote for the local repo you are working.
Assume the local git repo (R project) is opened in R Studio, so you can add remote in R Studio terminal window or through git command line:
git remote add origin \\\\share\\path\\gitrepo
Note:
The count of slash \ in the remote repo url.
And the pull and push button is still disabled after adding remote repo since the local branch (maste) has not tracked the remote branch (origin/master).
Then you can commit changes and push to remote repo first time by:
git push -u origin master
After that (local master is tracking origin/master), the pull and push button will be enabled after refresh the git tool bar. And can pull/push by clicking the buttons afterwards.
Option 2: host the remote git repo to third-party private repo
If it’s ok for you to hosted your git repo to third-party, and do not let everyone has read permission, then you can create a private git repo in the third-party organization.
For bitbucket, it’s free to create private git repos, so you can host your git repo there.

r studio fatal: No configured push destination

I'm trying to create a blog using R package blogdown.
The last step is to push my files to Github, and I clicked "Push Branch",
which gave me this error message:
I'm not very experienced with Git/Github integration with R Studio. Can somebody leave a detailed explanation of what to do?
Syntax
You add remote git server URL to local git repository config like this
git remote add origin your_git_repository_url
Example
At git local repository folder, release command:
git remote add origin https://github.com/donhuvy/java9.git
Learn more
https://git-scm.com/book/en/v2/Git-Basics-Working-with-Remotes#_adding_remote_repositories (official reference document)
https://help.github.com/articles/adding-a-remote/

Git push failure (Github/RStudio)

I've used Git successfully on this machine in the past but suddenly I can no longer push my commits to the Github repo. The last change to the Git toolchain that I made was to install Git 1.8.5.2, in addition to the Github for Windows client. RStudio could not find Git unless I'd already started the Github client so I decided to simply install a stand-alone Git client and change the RStudio Git path.
Error message (RStudio):
error: cannot spawn rpostback-askpass: No such file or directory
fatal: could not read Username for 'https://github.com': No such file or directory
Troubleshooting:
I can commit all projects.
I can pull new projects.
I cannot push any projects, I receive the same error message every time.
I cannot push with Github or RStudio.
Reinstalling /uninstalling Git / Github does not resolve the issue.
Setup:
This is an R project, with RStudio as my IDE / Git GUI.
I'm using Git 1.8.5.2 for Windows 7.
Let me know if there's any more information that you need.
Update 1:
Git GUI tells me that:
Error: hook execution requires sh (not in PATH).
Let's see if I can fix that...
Found something that might help from here: https://github.com/STAT545-UBC/Discussion/issues/93
in RStudio, click on the "Tools" menu and select "Shell"
Run the following command: git push -u origin master
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 file so that you have new content to push
click on the "push" button in RStudio and this time the push should work
Found a different suggested solution here: https://github.com/OHI-Science/ohicore/issues/104
git config --global credential.helper osxkeychain

Resources