LoginSignup
3
1

More than 3 years have passed since last update.

GitHubのerror: GH007: Your push would publish a private email address.への対応方法

Posted at

問題

GitHubに新規リポジトリを作成し、ローカルのレポジトリをコミットをしようとしたところ、謎のエラーに遭遇しました。

作業内容

GitHubサイト上にリポジトリを作成後、ローカルで下記の通りにレポジトリ作成、コミット、プッシュを実行。

git init
git remote add origin git@github.com:username/reponame.git
git add .
git commit -m “initial commit”
git push origin master

した結果、下記のエラーが発生。

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

原因

下記条件の時にエラーが起きるようです。目的は意図しないメールアドレスの公開を防ぐためでしょう。

  • GitHubアカウントのメールアドレスを公開しない設定にしている
  • Publicなリポジトリを作成している
  • リポジトリのauthorが上記設定で非公開にしたメールアドレスになっている

解決策

解決先は単純でエラーに記載の通り、メールアドレスの公開設定を変更するだけです。

メールアドレスの公開設定を変更

アカウントの設定ページを開き、下記のチェックを外します。
email_cofig.png

GitのAuthor設定変更はGitHubのこの記事などを参照してください。

3
1
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
3
1