clone 項(xiàng)目
git clone https://github.com/xxx/learngit.git
clone報(bào)錯(cuò):fatal: unable to access 'https://github.com/xxx/learngit.git/': LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443
git config --global --unset http.proxy
git config --global --unset https.proxy
查看用戶名和郵箱地址
git config user.name
git config user.email
修改用戶名和郵箱地址
git config user.name yourName
git config user.email yourEmail
刪除文件
git rm -r yourFileName // 這種方式相當(dāng)于右鍵本地磁盤刪除的效果,如果 push到遠(yuǎn)端自然就刪除了
git rm -r --cached yourFileName // 有人說(shuō)這種不會(huì)刪除本地,一旦 push 到遠(yuǎn)端,會(huì)將遠(yuǎn)端的該文件刪除,但是我嘗試的是無(wú)論是本地還是遠(yuǎn)端都不會(huì)被刪掉,還是別整這些花里胡哨的,直接右鍵刪除不香嗎
關(guān)于.DS_Store
// 如果遠(yuǎn)端已經(jīng)有了.DS_Store 文件,需要先刪除本地文件
find . -name '*.DS_Store' -type f -delete
git add .
git commit -m 'delete .DS_Store'
git push
// 此時(shí)遠(yuǎn)端庫(kù)已經(jīng)沒(méi)有了.DS_Store 文件
// 添加該文件的忽略,進(jìn)入 vim
vim .gitignore
// i 進(jìn)入編輯模式,輸入以下內(nèi)容
.DS_Store
*/.DS_Store
// ESC 進(jìn)入底部命令模式輸入以下內(nèi)容:
:wq // 進(jìn)入底部命令模式,保存并退出
// 正常push 到遠(yuǎn)端即可
顯示mac隱藏文件:command + shift + .