创建新项目
在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文章
566浏览量
24741 -
C++
+关注
关注
22文章
2108浏览量
73645 -
GitHub
+关注
关注
3文章
471浏览量
16440
发布评论请先 登录
相关推荐

github是什么_github有什么用
github使用教程_github菜鸟教程

GitHub发布史上最大更新
干货:如何定制自己的 GitHub 首页
提高访问Github过慢的方法
RT-Thread中的Github Actions

如何提高github访问速度

重塑GitHub、颠覆程序开发:GitHub Universe 2023发布重大更新

评论