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
Related
I'm trying to push my files to my GitHub, but I'm getting the following error:
error: cannot run rpostback-askpass: No such file or directory
fatal: could not read Username for 'https://github.com': Device not configured
Details:
I'm using MAC
My git version: git version 2.32.1 (Apple Git-133)
I'm linking my project to GitHub with HTTP protocole
I ran git config --global user.name and user.mail in the terminal in Rstudio
I tried to use the solution of running git push -u origin main and when I type in my credentials, it gives me the error: "authentication failed". I never changed my password to GitHub, I checked it today to enter the website, it works.
I tried using ssh protocol instead but it seems to be giving me even more errors even though I created my ssh key and added it successfully to my GitHub. Specifically when I click on create new project and add the ssh link Rstudio says:
Cloning into 'data-science-hw'...
ssh_askpass: exec(rpostback-askpass): No such file or directory Host key verification failed.
fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.
I went through all the possible suggestions I could find on the internet but none of them worked. I also tried linking a token generated by git, but it work either.
I would be very happy if anybody has any idea what else I could try..
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.
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
I am trying to set up a "simple" git workflow for a Wordpress installation that has a local version, a staging version and a production version. All I want to do is make changes locally and push from local to staging and from local to production. At first I thought this would be a simple task. I have been able to initialize the repository, add the two remotes "staging" and "production", initialize git on the remotes and push changes from my local version to the staging and production servers normally using the commands:
git add .
git commit -m "some changes"
git push staging master
git push production master
However, at some point during my work something changed, and while I am still able to push to Staging, now I am unable to push to the Production server without getting the error:
! [remote rejected] master -> master (Working directory has unstaged changes)
When I do "git status" it says:
On branch master
nothing to commit, working tree clean
After reading the answers to several SIMILAR BUT DIFFERENT questions on Stack Overflow I have tried the following:
git pull staging master
git pull staging master --rebase
git pull production master
git pull production master --rebase
I also tried executing this command on the remote servers
git config --local receive.denyCurrentBranch updateInstead
I have already completely re-created the servers and repositories a few times just to re-install git entirely from scratch, but this problem keeps happening after a while and at this point Git is actually HURTING my workflow instead of helping it. If anyone has any insight into what my mistake is, it would be much appreciated!
I had similar problems, pushing to a non-bare remote repo where I wanted the working copy files to be checked out immediately.
My remote was configured with receive.denyCurrentBranch updateInstead, but it still refused to accept pushes at unpredictable times.
Git 2.4 added a push-to-checkout hook, which can override such push failures.
I wrote a short script based on the example in the githooks documentation.
#!/bin/sh
set -ex
git read-tree --reset -u HEAD "$1"
I installed this script in .git/hooks/push-to-checkout in my remote repo.
Note that this script overwrites the working copy in the remote — it does not attempt to merge any changes to those files.
That's because I want the working copy to simply reflect the files in the repo.
Making a git bare repo is the best practice to push to.
You could push to a non-bare one... but only if you are not modifying files on the destination side while you are pushing file from the source side. See push-to-deploy.
But the best practice remains to add a post-receive hook (as in my other answer) in order to checkout in an actual folder all the files you have received.
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/