Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Respect Github "Keep my email address private" Setting #2976

Open
coder0107git opened this issue Feb 21, 2024 · 7 comments
Open

Respect Github "Keep my email address private" Setting #2976

coder0107git opened this issue Feb 21, 2024 · 7 comments

Comments

@coder0107git
Copy link

coder0107git commented Feb 21, 2024

Description

On Codeflow (may also apply to Webflow or Classic editor, haven't tested on those though), pushing commits fails if you have the Github setting "Keep my email address private" enabled. This is basically the same issue as #1963 and gitpod#387.

Steps to Reproduce

  1. Enable "Keep my email address private" in Github settings.
  2. Open any Github repo that you have commit access to.
  3. Change a file and commit
  4. Try to push changes
  5. See git error log for error

Note: All of this is through the UI, not the command line (although it probably applies to the command line too).

Expected Behavior

Be able to push commits.

Work around

> # ID and USERNAME can be retrieved at https://api.github.com/users/{USERNAME}
> git config user.email "ID+USERNAME@users.noreply.github.com"
>
> # Print configured email to make sure it updated correctly
> git config user.email
>
> git add -A
> git commit -m "Test commit"
> git push
@cukabeka
Copy link

I can confirm this, also the related #1963
I tried changing my git email with
git config --global user.email "my@mail.com"
or
git config user.email "my@mail.com"
in the terminal, but this seems to make the terminal hang. I can only exit the command with ^C back to the bash prompt with no mails changed.

@samdenty
Copy link

👋 we have a fix in the way, @SamVerschueren is working on it

@SamVerschueren
Copy link

Yes exactly. We're working on it but can't give an ETA yet on when it will land.

@elliottregan
Copy link

Thank you! I've gotten stuck on project recently because I had made a few commits, couldn't push. Couldn't rebase to change the author of those commits either because I the terminal version of git doesn't have a rebase command.

@W1Real
Copy link

W1Real commented Mar 19, 2024

You can save this as push.sh and execute, or you can simply paste it.

You can find your github commit email here: https://github.com/settings/emails

Add to your .gitignore because you don't want to push this dirty hack to the repo, if you prefer to save it.

Use it at your own risk. I'm not sure what side effects this might have. I added "&&" to have some extra reassurance, but I'm not a pro at bash scripts

git config --global user.email "EMAIL GOES HERE" && \
git config --global user.email && \
git add -A && \
git commit -m "COMMIT MESSAGE" && \
git push

If you prefer to save, paste this to execute it: chmod +x push.sh && ./push.sh

@circle-gon
Copy link

circle-gon commented Apr 19, 2024

Will the fix land anytime soon? I want to use stackblitz codeflow but I can't get it to use my GitHub private email. The workaround doesn't work, it hangs the terminal and after using ^C, nothing happens to the commit email (it's still the same).

edit: I've found a workaround using the simple-git npm package. Paste this in a js file that you can run using node then commit from the command line (not the IDE).

// RUN THIS ON A NEW STACKBLITZ INSTANCE AND USE THE COMMAND LINE TO PUSH

import { simpleGit } from "simple-git"

// this apparently breaks without this wrapper, even for type=module in package.json
(async () => {
    try {
      const git = simpleGit()
      await git.addConfig("user.email", "insert email", false, "global")
      await git.addConfig("user.name", "insert name", false, "global")
      
      console.log("Done setting config!")
    } catch (e) {
        console.log("Uh oh, something went wrong...")
        console.error(e)
    }
})()

@elliottregan
Copy link

Any updates on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants