LoginSignup
1
0

More than 3 years have passed since last update.

push declined due to email privacy restrictions

Last updated at Posted at 2021-01-21

事象 : GitHubにプッシュして怒られた

  • 環境
    • macOS Big Sur バージョン11.1
    • git version 2.28.0
$ git push
Enumerating objects: 3, done.
Counting objects: 100% (3/3), done.
Delta compression using up to 4 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (2/2), 282 bytes | 282.00 KiB/s, done.
Total 2 (delta 1), reused 0 (delta 0)
remote: Resolving deltas: 100% (1/1), completed with 1 local object.
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/{ユーザ}/qiita-shitagaki.git
 ! [remote rejected] master -> master (push declined due to email privacy restrictions)
error: failed to push some refs to 'https://{ユーザ}:{トークン}@github.

原因 : 非公開のメールアドレスでのコミットをプッシュしているから

メッセージの訳
電子メールのプライバシー制限によりプッシュが拒否されました

そういえばそんな変更したな・・・

Block command line pushes that expose my email
If you push commits that use a private email as your author email we will block the push and warn you about exposing your private email.
(ざっくり訳)
メールを公開するコマンドラインプッシュをブロックする
プライベートメールを作成者のメールとして使用しているコミットをプッシュすると、プッシュをブロックし、プライベートメールを公開することを警告します。
image.png

対応 : 違うメールアドレスを設定してやり直す

# 1. コミットを取り消す
$ git reset --soft HEAD^

# 2. 非公開にしたのとは違うメールアドレスを設定する
$ git config user.email '{違うメールアドレス}'

# 3. 今一度コミットする
$ git commit -m 'Qiitaに投稿した。'
[master 177393c] Qiitaに投稿した。
 1 file changed, 22 deletions(-)
 delete mode 100644 いろいろなログの場所.md

# 4. プッシュする
$ git push
Enumerating objects: 3, done.
Counting objects: 100% (3/3), done.
Delta compression using up to 4 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (2/2), 305 bytes | 152.00 KiB/s, done.
Total 2 (delta 1), reused 0 (delta 0)
remote: Resolving deltas: 100% (1/1), completed with 1 local object.
To https://github.com/{ユーザ}/qiita-shitagaki.git
   d631d06..177393c  master -> master
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0