赞
踩
创建一个仓库
创建一个文件夹,里面放要上传的内容
右键文件夹,选择Git Bash Here
1、首先执行
git init
显示
Reinitialized existing Git repository in E:/vue/课堂代码/demo/PC端/monthAdmin/.git/
2、之后执行
git add .
显示
warning: LF will be replaced by CRLF in .gitignore. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in README.md. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in babel.config.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in package-lock.json. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in package.json. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in public/index.html. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/App.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/router/index.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/store/index.js. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/views/Home.vue. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in src/views/Login.vue. The file will have its original line endings in your working directory
3、提交到本地仓库
git commit -m "注释的内容"
4、提交代码到gitee
git remote add origin 远程项目的Https地址
5、上传到gitee
git push origin master
6、输入账号密码。
niusongcun
NIUniu.521
注意可能遇到的错误
github上传时出现error: src refspec master does not match any解决办法
[https://www.jianshu.com/p/8d26730386f3]
解决方法
touch README
git add README
git commit -m 'first commit'
git push origin master
git push后出现错误 ![rejected] master -> master(non-fast-forward) error:failed to push some refs to XXX
https://blog.csdn.net/awm_kar98/article/details/89463117
本地创建了一个project
并在码云上创建了一个仓库,想要将本地的仓库链接到远程仓库
我用的是如下方法:
git init 初始化本地仓库
git remote add origin XXX 添加远程仓库地址
如果你在这之后就执行
git add -A,
git commit -m " "
git push origin master,那么就会出现这个问题(被拒绝),所以在remote add后不要着急git add,一定要git pull origin master,出现这个原因
是因为你在码云创建的仓库有ReadMe文件,而本地没有,造成本地和远程的不同步,
那么有两种方案可以解决:
one :
本地没有ReadMe文件,那么就在本地生成一个:
git pull --rebase origin master 本地生成ReadMe文件
git push origin master
two:
那我就强制上传覆盖远程文件,
git push -f origin master
(这个命令在团队开发的时候最好不要用,否则可能会有生命危险)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。