当前位置:   article > 正文

向gitee上传文件

向gitee上传文件

gitee上传文件

创建一个仓库
在这里插入图片描述
创建一个文件夹,里面放要上传的内容
在这里插入图片描述
右键文件夹,选择Git Bash Here
在这里插入图片描述
1、首先执行

git init
  • 1

显示

Reinitialized existing Git repository in E:/vue/课堂代码/demo/PC端/monthAdmin/.git/
  • 1

2、之后执行

git add .
  • 1

显示

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
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22

3、提交到本地仓库

git commit -m "注释的内容"  
  • 1

4、提交代码到gitee

git remote add origin 远程项目的Https地址
  • 1

5、上传到gitee

git push origin master
  • 1

6、输入账号密码。

niusongcun
NIUniu.521
  • 1
  • 2

注意可能遇到的错误
github上传时出现error: src refspec master does not match any解决办法
[https://www.jianshu.com/p/8d26730386f3]

解决方法

touch README
  • 1
git add README 
git commit -m 'first commit'
git push origin master
  • 1
  • 2
  • 3

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
(这个命令在团队开发的时候最好不要用,否则可能会有生命危险)

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/空白诗007/article/detail/962972
推荐阅读
相关标签
  

闽ICP备14008679号