github icon indicating copy to clipboard operation
github copied to clipboard

Confusing error message when pushing with `Block command line pushes that expose my email` enabled on GitHub

Open Jademalo opened this issue 7 years ago • 12 comments

Update by @rsese with updated repro steps and description

If you have Block command line pushes that expose my email enabled in your GitHub settings and try to push a commit with a private email, you see this error notification:

The tip of your current branch is behind its remote counterpart. Try pulling before pushing.
To force push, hold cmd or ctrl while clicking.

The error with more information shown on the command line and in devtools in Atom is:

stderr: 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: http://github.com/settings/emails        

push-error

Steps to reproduce:

  1. Enable Block command line pushes that expose my email in https://github.com/settings/emails
  2. For some repo, add and commit a change that uses a private email address
  3. Push the change

Expect the error message to explain the underlying error, actual behavior is the error message mentioned above.


Prerequisites

Description

When attempting to push a commit to GitHub, I get the following error;

The tip of your current branch is behind its remote counterpart. Try pulling before pushing.
To force push, hold cmd or ctrl while clicking.

Force push also throws the same error.

Steps to Reproduce

  1. Create a new, empty repo, then clone it into atom
  2. Edit a file, and create a commit
  3. Attempt to push the commit

Expected behavior:

I expected it to push the commit and change on GitHub

Actual behavior:

It threw the above error

Reproduces how often:

100% of the time

Versions

Atom    : 1.34.0
Electron: 2.0.16
Chrome  : 61.0.3163.100
Node    : 8.9.3

apm  2.1.3
npm  6.2.0
node 8.9.3 x64
atom 1.34.0
python
git
visual studio 2015

Additional Information

I have absolutely no idea what I'm doing wrong here. This is a fresh install of atom. All I did was clone the repo, link my GitHub account, make a commit, and try to push it. This happens with any repo, regardless of where I clone it from.

Searching for that error message results in one thing which says it's because I need to pull, but the repo is 100% up to date without question.

Jademalo avatar Jan 15 '19 08:01 Jademalo

Thanks for the report - I just ran through your repro steps but couldn't reproduce:

  1. Create a new, empty repo, then clone it into atom
  2. Edit a file, and create a commit
  3. Attempt to push the commit

Just to add more detail to these steps, can you confirm if this is still correct? This is what I did:

  1. Create a new empty repository on github.com (i.e. make sure Initialize this repository with a README is not checked)
  2. Start Atom
  3. Copy the repository URL and use it to clone with GitHub: Clone
  4. Create a new file (e.g. README.md), add some content e.g. "Hello World", and save it
  5. Click Stage All
  6. Add "Initial commit" for the commit message and click commit (it says "Create detached commit" at this point)
  7. Right-click "Fetch" in the status bar and choose "Push"

rsese avatar Jan 16 '19 01:01 rsese

That's exactly what I've done, bar a slight change on line 7 - It doesn't say fetch, it says Push 1.

I also attempted to pull before the push as per the error, but again I get exactly the same results. I also get the same error if Initialize this repository with a README is checked, not just empty.

Regardless of the repo, I get this error every single time.

Jademalo avatar Jan 16 '19 02:01 Jademalo

Did you use previous versions of Atom before 1.34.0? If so, is this problem new with 1.34.0?

rsese avatar Jan 17 '19 20:01 rsese

No I did not, this is the first version I've used. It's a totally fresh installation on a month old installation of Windows 10. I have no idea what could possibly be causing this.

Jademalo avatar Jan 18 '19 00:01 Jademalo

same error here

Sagar-MM avatar Feb 16 '19 21:02 Sagar-MM

Same error in my ubuntu+atom 1.20.2

Solved after I uncheck 'Keep my email address private'.

Details: In cmd git push -u origin master Username for 'https://github.com': userName Password for 'https://[email protected]': Counting objects: 9, done. Delta compression using up to 2 threads. Compressing objects: 100% (5/5), done. Writing objects: 100% (9/9), 771 bytes | 385.00 KiB/s, done. Total 9 (delta 1), reused 0 (delta 0) remote: Resolving deltas: 100% (1/1), done. 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: http://github.com/settings/emails To https://github.com/etileyli/someRepo.git ! [remote rejected] master -> master (push declined due to email privacy restrictions)

etileyli avatar Mar 24 '19 12:03 etileyli

  1. First of all clone the directory in which you want to commit.
  2. Then open that directory in Atom
  3. Now copy the file which you want to commit and paste it inside the cloned folder.
  4. Now commit. It worked for me.

bishnumurmu avatar Jul 02 '19 07:07 bishnumurmu

I was also having the same issue as mentioned by @Jademalo but after reading comment, posted by @etileyli reminded me that I also have done the same thing, to undo that

  1. Go to Email Setting

  2. Uncheck email settings

  3. Then try again as mentioned by @rsese

drkurrey avatar Jul 23 '19 12:07 drkurrey

I was also having the same issue as mentioned by @Jademalo but after reading comment, posted by @etileyli reminded me that I also have done the same thing, to undo that

  1. Go to Email Setting
  2. Uncheck email settings
  3. Then try again as mentioned by @rsese

thank you so much! i fixed my problem.

yovamacua avatar Aug 15 '19 20:08 yovamacua

Awesome, that fixed it for me, thank you!

As another note, it's possible to use the GitHub assigned noreply email to get the same result. image

Just use that email there, and it will push without error.

Jademalo avatar Sep 01 '19 03:09 Jademalo

Ahhh ok, thanks @etileyli for tracking down the issue, reproduced with 1.42.0-nightly5 on macOS 10.14.6. I should have asked to check devtools console, I see the same error from the command line shown there too:

push-error

Updated the issue title and repro steps.

rsese avatar Sep 06 '19 21:09 rsese

None of these solutions worked for me :(

cwagoner78 avatar Mar 04 '22 18:03 cwagoner78