github操作简介
如何上传一个项目?
首先先在github上创建自己的项目:
创建好项目之后,将项目clone到本地:
git clone https://github.com/“github用户名称”/”项目仓库名称”.git
然后将命令行切换到项目目录下,初始化项目仓库:
git init
如果要添加README.md文件,请执行:
git add README.md
然后可以编辑项目了,直到需要提交项目
提交项目,先把项目扫描对比,提交到本地仓库中,并填写提交说明:
git commit -m “提交说明”
之后将项目远程添加到指定仓库:
git remote add origin https://github.com/“github用户名称”/”项目仓库名称”.git
最后推送上传整个项目:
git push -u origin master
错误:nothing added to commit but untracked files present
git add 文件名 //将文件一个一个的添加到仓库中git - error: failed to push some refs to ‘https://github.com/Tate-zwt/WTMicroblog.git” 解决办法
执行以下命令:
git push -f origin master
“fatal: ‘origin’ does not appear to be a git repository fatal: Could not read from remote repository.”解决办法
执行以下命令:
git add .
git commit -m “提交说明”
git push -u origin master
上传到github上的项目标注的语言类型是github自动识别的,但是并不是我想要的语言类目,需要暴力解决
我们可以在仓库的根目录下添加.gitattributes文件:
使用 `.gitattributes` 配置文件
具体就是在项目根目录添加文件名为.gitattributes
的文本文件,写入如下格式的配置
*.js linguist-language=java
*.css linguist-language=java
*.html linguist-language=java
意思是将.js、css、html当作java语言来统计
向README.md文件中添加图片
在README.md文件中加入