- 本地仓库使用命令初始化
$ git init
2 使用如下命令添加远程库
git remote add origin https://gitee.com/GZCXR/agricultural-greenhouse
3 使用push
git push -u origin master
出错
error: src refspec master does not match any
error: failed to push some refs to 'https://gitee.com/GZCXR/agricultural-greenho
use'
4解决方法
使用git add . 添加上传文件
git add .
git commit -m "init files"
5 然后直接push会报错,需要先pull一下
git pull --rebase origin master
- push 此时就会成功
$ git push -u origin master
Enumerating objects: 313, done.
Counting objects: 100% (313/313), done.
Delta compression using up to 8 threads
Compressing objects: 100% (306/306), done.
Writing objects: 100% (313/313), 1.62 MiB | 1.30 MiB/s, done.
Total 313 (delta 145), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (145/145), done.
remote: Powered by GITEE.COM [GNK-6.3]
To https://gitee.com/GZCXR/agricultural-greenhouse
* [new branch] master -> master
Branch 'master' set up to track remote branch 'master' from 'origin'.