天天看點

解決送出到github報錯Please tell me who you are.和為不同的項目設定不同的名稱

今天部落客正在愉快地學習在AndroidStudio中使用Git,正看着這篇文章 http://www.mamicode.com/info-detail-512945.html

眼看就要成功了,結果報了下面這個錯∑(っ°Д°;)っ:

Can't finish GitHub sharing process

Successfully created project 'Test' on GitHub, but initial commit failed:

* Please tell me who you are. Run git config --global user.email "[email protected]" git config --global user.name "Your Name" to set your account's default identity. Omit --global to set the identity only in this repository. fatal: empty ident name (for (null)>) not allowed during executing git -c core.quotepath=false commit -m "Initial commit" --

看了一下原來是git沒有配置的原因,找到git目錄下的Git Bash運作,輸入下面兩行代碼即可(什麼鬼居然還要指令行配置,就不能做個某Q登入那樣的界面一登入就好了麼!或者是明明有其他的配置方式但是部落客不知道∑(っ°Д°;)っ,有知道的小夥伴一定要告訴部落客!):

git config --global user.email "[email protected]"  

git config --global user.name "Your Name"

--------------------------------------2016/08/30--------------------------------------

上面的方法配置的是全局的使用者名和郵箱!就是說如果沒有單獨為項目配置,那送出的所有項目全部都是這個名字和郵箱!不管是公司項目還是github,還是碼雲!很蛋疼有木有,當碼雲送出記錄上出現我名字的時候我都驚呆了!

單獨為項目配置的方法(全局和單獨配置都存在的時候會預設使用項目單獨配置的):

1.打開項目所在目錄,找到隐藏的.git檔案夾。注意這個檔案夾是隐藏的,顯示隐藏出來就行。

2.打開檔案夾裡的config檔案,推薦用nodepad++打開。

3.添加這三行到檔案:

[user]

name = XXX(自己的名稱)
email = XXXX(郵箱)           

當然也可以通過指令行的方式,隻需要在 .git 檔案夾下。 例如執行如下指令:

git config user.name "xxxxx"