刚刚开始接触git,上网百度,发现都是直接告诉你命令怎么写。尝试一番后,问题出现了。
按照网上教程,我先在gitee注册账户,创建仓库,获取它的https。
然后在项目文件夹上右击git bash:
git init
git add .
git commit -m "first commit"
git remote add origin https://gitee.com/xxx/xxx.git
git push -u origin master -f #-f强制上传
这里就出现error:src refspec master does not match any
后来知道,是文件没有放入仓库。
于是:
git clone https://gitee.com/xxx/xxx.git #将gitee的仓库克隆下来
把项目文件放入克隆的仓库文件夹里,可用cd进入文件,ls查看文件。确定项目文件都在仓库文件夹中后,输入命令:
git add .
git commit -m "first commit"
git remote add origin https://gitee.com/xxx/xxx.git
git push -u origin master -f #git push origin master
主要问题是项目文件没有放入仓库文件夹里才会出现src refspec master does not match any的错误,因为仓库的文件夹里是空的。
git将文件提交到gitee仓库中
最新推荐文章于 2024-05-21 16:36:12 发布