把本地仓库同步到github上去

1.愚蠢的没有进入之前设定的工作目录就开始用

git remote add origin https://github.com/bobowa/learngit.git

这个命令上传,报错如下

fatal: Not a git repository (or any of the parent directories): .git

然后看别人说用

git init

就可以了,我用了确实没再报错了。然后继续用

git push -u origin master

时,有报错。报错如下:

error: src refspec master does not match any.
error: failed to push some refs to 'git@github.com:hahaha/ftpmanage.git'

然后查资料说这是本地仓库为空的意思。解决方法,添加文件;

然后我意识到问题不对了,因为我之前有add过文件的,而且好多次,然后在git客户端中pwd看了一下路径,果然不是我之前创建的目录。不知道为啥附着在开始页和Win+Q找出来的git客户端打开后的默认目录是不一样的。愚蠢的问题导致我折腾了大半天

原文地址:https://www.cnblogs.com/wangboqi/p/10242152.html