I’ve had a Github account for some time, and posted a test repo a couple of years ago. I’m starting in the CLI and I can’t get my certificate to work. Github isn’t approving me.
I have two certs on my workstation. I made one specifically for Github. I tried using that cert, and I’ve moved back to my original cert, because the second cert created confusion with ssh into other boxes.
So I created a remote repo with a similar name and on my workstation as well. I copied the files into that local repo and it still won’t work. At this point I don’t know what to do. Any advice appreciated how I can handle this.
If you are referring to GitBash or GitCMD provided with git-scm client. There is help documentation here https://docs.github.com/en/authentication/connecting-to-github-with-ssh. There is also a troubleshooting section there also. Alternatively you can use sign in with browser or a personal access token which is often easier for users unfamiliar with how to configure SSH keys/
Yes, I understand what I’m trying to do. That’s not the issue. It’s just not happening for some reason. Every time I go to push, it says the repo is not there.
What I just tried, last for tonight:
git remote set-url origin email@example.com:daBee/test123.git
git add -A
git commit -m "first commit"
git branch -M main
git remote add origin firstname.lastname@example.org:daBee/test123.git
git push -u origin main
On branch main
nothing to commit, working tree clean
error: remote origin already exists.
Enumerating objects: 10, done.
Counting objects: 100% (10/10), done.
Delta compression using up to 8 threads
Compressing objects: 100% (4/4), done.
Writing objects: 100% (10/10), 702 bytes | 702.00 KiB/s, done.
Total 10 (delta 0), reused 0 (delta 0), pack-reused 0
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 rejected] main -> main (push declined due to email privacy restrictions)
error: failed to push some refs to 'github.com:daBee/test123.git'
They are both the same and set to private. Why do I need a second email private email? I was also told that my public-key had nothing to do with emails. So I need one email on github, and a different one locally? I’m really confused now.
That depends on what you want. Git records the configured author name and email address in each commit you make. This information is available to everyone with access to the repository.
GitHub uses the email address to assign commits to user accounts. Some people might not want to make their actual email address available to others, in that case you can use a pseudo-address (“pseudo” as in, it looks like an email address, but you can’t send mail to it) similar to email@example.com, and it’ll work to match your commits, too. Additionally there’s the option to block pushes that would expose your actual mail address. It looks like you have enabled that, and the commits you’re trying to push contain your actual email address.
So the question is: Do you want to make your email address public, or use the users.noreply.github.com address for your commits on the command line, too?
I don’t want to publish. I’ve set that already. But having my proper email in both my cert generation and what’s on github, still kicks up that error. So even moving to a spoofed email address, wouldn’t the problem still be there? The problem, as it stands and as has been presented, is that the authentication of the proper email isn’t working for some reason, on a push already. So I’m confused as to what to do.
No. The error message you quoted above clearly states what the issue is, and it’s about the commits being pushed containing the email address you want to keep private. That has nothing to do with authentication. If you want to keep your email address private, you need to replace it with the users.noreply.github.com one for your account in those commits.
I make my public-keys here on my workstation. It requires an email address, spoofed or otherwise. OK the syntax/error is not clear enough for me to understand then. That might need to be re-worded. I will generate another key and try again.
Ah, so you mean the public key pair for SSH? That already works, otherwise you wouldn’t get the error message you see. No need to create a new one. The identifier for an SSH key usually looks like a mail address (user@host) but doesn’t matter whatsoever.
Once again, the error message is about the commits being pushed, and the author data in those.
Author information for each commit is part of the repository history, so it’s available to anyone with access to the repository. If the repository is public that means it’s visible to the world. I assume the “Block command line pushes that expose my email” option exists exactly because that’s a possible misunderstanding, and to prevent mistakes. But it doesn’t change the commits when you push (otherwise the pushed history wouldn’t fit the local one), it only prevents the push exactly as you saw.
So, if you want to keep your mail address private for future commits you should set your user.email to your users.noreply.github.com address (you can find it in the email section of settings).
To push the already existing commits without revealing your mail address you’ll have to rewrite the repository history, or if it was just a test repository (like the name test123 indicates) discard it and try again.