master (push declined due to email privacy restrictions) 異常原因: 配置..."/>
溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

push declined due to email pri

發(fā)布時間:2020-10-07 11:55:20 來源:網(wǎng)絡(luò) 閱讀:640 作者:bournew 欄目:軟件技術(shù)

將本地倉庫 push 到 github 報錯:

異常信息:

! [remote rejected] master -> master (push declined due to email privacy restrictions)

異常原因:

配置 git 時設(shè)置了作者郵箱信息,觸發(fā)了Github 隱私保護(hù)設(shè)置:
Block command line pushes that expose my email

解決方法:

關(guān)閉 Block command line pushes that expose my email 這個選項:

很多人選擇關(guān)掉 GitHub 中 Email 設(shè)置選項 Block command line pushes that expose my email ;很粗暴但是不推薦。

個人推薦:

更改 git 配置的郵件地址:
如果不想關(guān)閉上面的設(shè)置,可以通過修改 Email 來解決:

1、使用命令查看當(dāng)前的全局用戶 Email:
    git config --global user.email

2、找到你 GitHub 給的推薦 Email:
    在 settting --> Email --> keep my Email private 選項下的 Email;
        格式是:id+username@users.noreply.github.com

3、重新設(shè)置你的全局用戶 Email:
    git config --global user.email "GitHub 給的推薦 Email"

4、重置上次提交的作者信息
    git commit --amend --reset-author

        輸入命令后,進(jìn)入vi模式( git 默認(rèn)的編輯器);
        不熟悉的,可以直接在英文輸入法下:wq(冒號wq)保存

5、提交
    git push

如果沒有其他問題,大功告成。

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI