r studio fatal: No configured push destination - r

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/

Related

Creating a git repo for an existing R project - "fatal: Couldn't find remote ref master" error

I want to finally start using version control for my R projects. I started following this guide, created an empty repo, but the problem started when I got to the command line part.
First I did:
git remote add origin https://github.com/username/repo_name.git
But after I type:
git pull origin master
I get this error:
fatal: Couldn't find remote ref master
Now, if I try the following:
git remote -v
I get:
origin https://github.com/username/repo_name.git (fetch)
origin https://github.com/username/repo_name.git (push)
So something is working. I am new to git and not sure about where the problem is.
As an attempt to fix the problem, I added one file for the repository (file.R) but apart from that, the repository is empty. I get the same error as before.
And if I try git branch -r on the terminal I don't get anything in return.
If you started by creating an empty repo in GitHub, then the default branch is no longer master. The default branch is now main.
If you started by creating a new repo locally using git init, then check what your default branch is using git branch. This should show you either a main or master branch.
It may be easier to create the repo in GitHub with a simple README.md and .gitignore, then clone that repo to another folder. Move your code into that repo, add and commit everything, then push your code to GitHub.

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

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

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.

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