0

I want to push commits to GitHub and followed the directions from How to Use Git/GitHub with R. Unfortunately, I ran into issues running the following code as my personal email is private.

library(usethis)
use_git_config(user.name  = "MyUserName", 
               user.email = "[email protected]")

I have attempted to change my personal email to the public one provided by GitHub two ways. First, using:

use_git_config(user.name  = "MyUserName", 
               user.email = "{ID}+{username}@users.noreply.github.com")

Second, by changing my email in the terminal:

git config --global user.email "{ID}+{username}@users.noreply.github.com"
git config --global --list

The latter line does show that the email was correctly updated.

I've also restarted R/RStudio, but I still get the same error messages when I try to push the commit. Error message:

remote: error: GH007: Your push would publish a private email address.        
remote: You can make your email public or disable this protection by visiting:        
remote: https://github.com/settings/emails        
To https://github.com/repository
 ! [remote rejected] HEAD -> main (push declined due to email privacy restrictions)
error: failed to push some refs to 'https://github.com/repository'

What can I do to resolve this issue?

1 Answer 1

0

It turned out the issue was that the commit was still tied to my personal email, so I uncommitted my changes in the terminal (see this answer), and then redid the commit and push in RStudio.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.