1.git init 初始化
2.touch .gitignore
3.git status //查看状态
4.git add . //添加到版本控制
5.git commit -m “2019年9月5日 05:34:38”
6.git push
新项目推送到github
1.前面的工作先做好.
2.git remote add origin 自己的git地址
3.git push -u origin master //如果第一次线上有内容需要清空的,否则不能push
解决办法:先git pull拉回来(注意本地数据的备份)再合并,或者直接git push -f -u origin master进行强制覆盖远程库操作.
–
…or create a new repository on the command line
echo "# nihk.tk" >> README.md git init git add README.md git commit -m "first commit" git branch -M main git remote add origin https://github.com/mabenteng/nihk.tk.git git push -u origin main…or push an existing repository from the command line
git remote add origin https://github.com/mabenteng/nihk.tk.git git branch -M main git push -u origin main…or import code from another repository
You can initialize this repository with code from a Subversion, Mercurial, or TFS project.
git修改gitignore不生效的问题.
原因是.gitignore只能忽略那些原来没有被track的文件,如果某些文件已经被纳入了版本管理中,则修改.gitignore是无效的。那么解决方法就是先把本地缓存删除(改变成未track状态),然后再提交:
git rm -r –cached .
git add .
git commit -m ‘update .gitignore’
也可以设定全局忽略规则,暂时bu [bu]