Reputation: 21
I'm trying to use git2r package in R to commit and push a file to my repository.
The code I'm using is like that:
# Clone existing github repo using url and linking this to your project path
clone(url = "https://github.com/path/repository", local_path = my_path)
# Assign variable repo as current local repository
repo <- repository(my_path)
# Configure access rights with github username and profile
config(repo, user.name='my_name', user.email= 'my_email')
# Setting my SSH credentials
cred <- git2r::cred_ssh_key(ssh_path("id_rsa.pub"), ssh_path("id_rsa"))
# Stage changs to commit
add(repo, "my_file.html")
commit(repo, "Commit message")
# Push changes
push(repo, 'origin', 'refs/heads/master', credentials = cred)
When pushing, I receive the following error:
Error in push(repo, "origin", "refs/heads/master", credentials = cred) :
Error in 'git2r_push': config value 'http.followRedirects' was not found
No idea what could be wrong. I haven't found much on internet about this error or what configuration is that. It looks like a simple issue, but I can't figure it out.
Any help is pretty much appreciated.
Upvotes: 0
Views: 283
Reputation: 153
I just experienced this today, and $ git config --global http.followRedirects true
resolved the issue for me.
Upvotes: 0
Reputation: 23
I had a very similar issue.
The error message is completely misleading. libgit2 tries to read the setting 'http.followRedirects'
from the git config, doesn't find it and stores the error message that you see as the string for the last error but then ignores the error. This is no problem.
However, then something else goes wrong (in a callback that is implemented in git2r). An error code is returned, however no string with the error description is saved.
git2r then sees its own error code and tells you the last error message, which is the message that you see.
I cannot say what the exact error is in this case, however I would suspect, that it is caused in the callback in git2r that creates the credentials for libgit2. Try to push to a local repository, where there are no credentials required and make sure the credentials exist and that you can push to github using ssh.
Upvotes: 1