創(chuàng)建新項(xiàng)目
在GitHub創(chuàng)建新項(xiàng)目:

創(chuàng)建Git文件
(1)在需要上傳的目錄打開powershell
(2)執(zhí)行命令創(chuàng)建隱藏的.git文件:
git init
添加用戶
項(xiàng)目的.gitconfig文件最后加入
[user]
name = name
email = email
否則會(huì)出現(xiàn)以下報(bào)錯(cuò):
Commit failed - exit code 128 received, with output: '*** Please tell me who you are.
Run
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
添加到Git
分別執(zhí)行add、commit,具體參考 Git的使用
(1)add/rm
添加全部文件:
git add -A
添加單個(gè)文件:
git add env.txt
刪除某個(gè)文件:
git rm env.txt
git add -A 表示添加所有內(nèi)容, git add .表示添加新文件和編輯過的文件不包括刪除的文件; git add -u 表示添加編輯或者刪除的文件,不包括新添加的文件。
(2)commit
對(duì)修改的描述
git commit -m "new"
關(guān)聯(lián)倉庫
將本地倉庫關(guān)聯(lián)到github上,XXX為倉庫名
git remote add origin https://github.com/Snowstorm0/XXX.git
Push
push到github:
git push -u origin master
常見報(bào)錯(cuò)
(1)add 時(shí) 報(bào)錯(cuò):
warning: LF will be replaced by CRLF in XXX
換行符錯(cuò)誤,在windows下使用以下代碼修改:
git config --global core.autocrlf true
(2)add 時(shí) 報(bào)錯(cuò):
fatal: not a git repository (or any of the parent directories): .git
重新添加git:
git init
(3)commit 時(shí) 報(bào)錯(cuò):
Commit failed - exit code 128 received, with output: '*** Please tell me who you are.
Run
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
需要到項(xiàng)目的.gitconfig文件最后加入
[user]
name = name
email = email
(4)commit 時(shí) 報(bào)錯(cuò):
fatal: could not open '.git/COMMIT_EDITMSG': Permission denied
對(duì)于Windows系統(tǒng)可以進(jìn)入.git文件(隱藏文件)刪除“COMMIT_EDITMSG”文件即可
(5)push 時(shí) 報(bào)錯(cuò):
fatal: unable to access 'https://github.com/Snowstorm0/': OpenSSL SSL_read: Connection was aborted, errno 10053
Git默認(rèn)限制了push的大小,更改限制即可:
git config --global http.postBuffer 524288000
審核編輯:湯梓紅
-
文件
+關(guān)注
關(guān)注
1文章
597瀏覽量
26110 -
C++
+關(guān)注
關(guān)注
22文章
2124瀏覽量
77351 -
GitHub
+關(guān)注
關(guān)注
3文章
489瀏覽量
18757
發(fā)布評(píng)論請(qǐng)先 登錄
github是什么_github有什么用
github使用教程_github菜鳥教程
GitHub發(fā)布史上最大更新
干貨:如何定制自己的 GitHub 首頁
Refined GitHub簡化GitHub界面并實(shí)用的瀏覽器擴(kuò)展
提高訪問Github過慢的方法
RT-Thread中的Github Actions
如何提高github訪問速度
重塑GitHub、顛覆程序開發(fā):GitHub Universe 2023發(fā)布重大更新
GitHub的使用
評(píng)論