创建新项目
在GitHub创建新项目:
创建Git文件
(1)在需要上传的目录打开powershell
(2)执行命令创建隐藏的.git文件:
git init
添加用户
项目的.gitconfig文件最后加入
[user]
name = name
email = email
否则会出现以下报错:
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
(1)add/rm
添加全部文件:
git add -A
添加单个文件:
git add env.txt
删除某个文件:
git rm env.txt
git add -A
表示添加所有内容, git add .
表示添加新文件和编辑过的文件不包括删除的文件; git add -u
表示添加编辑或者删除的文件,不包括新添加的文件。
(2)commit
对修改的描述
git commit -m "new"
关联仓库
将本地仓库关联到github上,XXX为仓库名
git remote add origin https://github.com/Snowstorm0/XXX.git
Push
push到github:
git push -u origin master
常见报错
(1)add 时 报错:
warning: LF will be replaced by CRLF in XXX
换行符错误,在windows下使用以下代码修改:
git config --global core.autocrlf true
(2)add 时 报错:
fatal: not a git repository (or any of the parent directories): .git
重新添加git:
git init
(3)commit 时 报错:
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"
需要到项目的.gitconfig文件最后加入
[user]
name = name
email = email
(4)commit 时 报错:
fatal: could not open '.git/COMMIT_EDITMSG': Permission denied
对于Windows系统可以进入.git文件(隐藏文件)删除“COMMIT_EDITMSG”文件即可
(5)push 时 报错:
fatal: unable to access 'https://github.com/Snowstorm0/': OpenSSL SSL_read: Connection was aborted, errno 10053
Git默认限制了push的大小,更改限制即可:
git config --global http.postBuffer 524288000
审核编辑:汤梓红
-
文件
+关注
关注
1文章
541浏览量
24467 -
C++
+关注
关注
21文章
2070浏览量
73024 -
GitHub
+关注
关注
3文章
458浏览量
16056
发布评论请先 登录
相关推荐
![](https://file.elecfans.com/web2/M00/B0/5F/poYBAGStceGAFp62AABdDPyyd_o552.png)
github的使用
github是什么_github有什么用
github使用教程_github菜鸟教程
![<b class='flag-5'>github</b>使用教程_<b class='flag-5'>github</b>菜鸟教程](https://file1.elecfans.com//web2/M00/A6/FB/wKgZomUMQZyAXHx9AAAyrusqjYc057.png)
干货:如何定制自己的 GitHub 首页
如何获取和使用Github上的开放资源
![如何获取和使用<b class='flag-5'>Github</b>上的开放资源](https://file.elecfans.com/web1/M00/EA/37/pIYBAGBv0NGAXSNWAABP-utEDG4139.png)
github-profile-summary GitHub资料可视化展示工具
![<b class='flag-5'>github</b>-profile-summary <b class='flag-5'>GitHub</b>资料可视化展示工具](https://file.elecfans.com/web1/M00/D9/4E/pIYBAF_1ac2Ac0EEAABDkS1IP1s689.png)
RT-Thread中的Github Actions
![RT-Thread中的<b class='flag-5'>Github</b> Actions](https://file1.elecfans.com/web2/M00/90/5C/wKgaomTYmKGAbV_fAAAHfzdYOo8035.png)
评论