此文章是笔者在 github 使用中的一些经验性总结,学习的新姿式会同步更新,记录。javascript
1. 新手推荐css
2. 帮助文档html
写好 md 很重要 !!!
github上能够使用https进行访问。前端
$ git config --global http.proxy http://web-proxy.oa.com:8080
可是这样能够clone了。可是若是要push代码,那就麻烦了。每次都须要输入密码,接着往下看。
.gitignore
过滤案例介绍,如前端 项目中充满数量庞大依赖文件的node_modules
,咱们不须要上传,靠package.json
文件下载依赖包就能够java
*.DS_Store node_modules # 过滤项目中名为 node_modules 的文件夹,作上传例外操做 bower_components .sass-cache npm-debug.log .idea .vscode
# git-忽略版本控制内某些文件的修改 git update-index --assume-unchanged application/Everything/Everything.ini
优雅的提交 code
,为 commit 本身的每次 commit 设置好的日志, 方便往后追溯:node
Headreact
Bodygit
Footergithub
补充:使用 svn 小乌龟提交代码没有强制须要写 commit log , 建议你们都写
每次提交代码时须要输入用户名密码,则说明你在从仓库中clone代码时使用的是HTTPS的key进行拉取代码。而使用SSH key拉取代码时,则不须要。web
(1). 建立文件 .git-credentials
存储GIT用户名和密码
# 建立 touch .git-credentials # 在vim中打开 vim .git-credentials # 文件内容 https://{username}:{password}@github.com
(2). 长期存储密码,进入git bash终端, 输入以下命令:
git config --global credential.helper store
通过这样操做后就能够免密登陆
了
注意事项
文件结构要与初始化链接 github
的.gitconfig
文件在同级别目录下
gh-pages
分支发布在线访问在本身的github项目上添加gh-pages
分支,并保证里面有须要展现的代码,以index.html
做为入口就ok,能够展现项目了
gh-pages
分支git subtree push --prefix=dist origin gh-pages
在项目根目录添加文件名为.gitattributes
的文本文件:
touch .gitattributes
写入:
*.js linguist-language=javascript *.css linguist-language=javascript *.html linguist-language=javascript
意思就是将.js
、.css
、.html
看成 javascript 语言来统计,简单有效
查看案例,将展现的语言变为
javascript
=>
King-of-glory
(1). git 推送出现 "fatal: The remote end hung up unexpectedly"
缘由:上传的文件过大,单个文件均小于 100M
解决办法:在项目.git
文件夹下寻找config
文件,添加以下代码:
[http] postBuffer = 524288000
(2). 用于上传单个文件大于100M失败时使用