.

iT邦幫忙

0

設定 GitHub private commit email,保護隱私又保留貢獻紀錄

  • 分享至 

  • xImage
  •  

當你使用 Git 進行版本控制時,commit 記錄中會公開顯示你的 email。這可能導致聯絡資訊的外洩,甚至引來垃圾郵件。

https://ithelp.ithome.com.tw/upload/images/20250107/20078303XQlB0gL4Pf.png

如果你不希望在 commit 中外洩你的聯絡資訊,而且又能夠保有 GitHub 貢獻紀錄如上圖,可以透過以下步驟設定 GitHub private commit email。

操作步驟

1. 登入 GitHub 帳號,點擊右上角個人照片,進入 Settings

https://ithelp.ithome.com.tw/upload/images/20250107/20078303fmWqLV4fZh.png

2. 進到設定頁面,到側邊欄選擇 Emails

https://ithelp.ithome.com.tw/upload/images/20250107/20078303eoff3X7FsQ.png

3. 勾選 Keep my email addresses private

https://ithelp.ithome.com.tw/upload/images/20250107/20078303QIoM3WYMQa.png

4. 接著在本地端設定,將 commit email 改為 GitHub private email

git config --global user.email "{youremail}@users.noreply.github.com"

註:{youremail} 請替換為你的 GitHub private email,通常會是數字+帳號的組合(可在 Emails 頁面查看)。

5. 檢查是否設定成功

git config --global user.email

若顯示的是你的 GitHub private email,則設置成功!

參考資料

GitHub 官方文件:Setting your commit email address

本篇文章也同步刊載在個人 Blog 上


.

尚未有邦友留言

立即登入留言