1.查看和修改用戶名和郵箱
$ git config --list //查看全局配置
$ git config user.name
$ git config user.email //查看
$ git config --global user.name "username"
$ git config --global user.email "email" //修改
2.獲取遠程Git repo,創(chuàng)建local copy.
$ git clone [url] //創(chuàng)建的repo將會以url最后一個/后面的名稱命名創(chuàng)建文件夾
$ git clone [url] newname //指定特定的名稱
- 提交代碼
$ git add . //遞歸地添加當前工作目錄中的所有文件
??在提交之前,Git上有一個暫存區(qū)以放置新添加的文件或加入的改動,commit時提交的改動是上一次加入到暫存區(qū)的改動。
$ git commit -m "the commit message" //提交已經(jīng)ADD進來的改動,并添加說明
4.免用戶名和密碼push
當使用https拉取項目后,每次進行push、pull等操作時會需要我們填寫用戶名和密碼。無疑這樣很繁瑣,所以可以設置一下實現(xiàn)免用戶名和密碼push:
檢查是否有credential.helper設置,沒有的話為空:
$ git config -l|grep credential.helper
設置:
$ git config credential.helper manager