解决failed to push some refs to git
在github上创建一个空仓库,名叫testgit,想把本地的git仓库关联起来,使用git push -u origin master命令,出现错误jiang@DESKTOP-H9PNI47 MINGW64 /d/File/Git (master)$ git push -u origin mastererror: src refspec master does not match an...
·
在github上创建一个空仓库,名叫testgit,想把本地的git仓库关联起来,使用git push -u origin master命令,出现错误
jiang@DESKTOP-H9PNI47 MINGW64 /d/File/Git (master)
$ git push -u origin master
error: src refspec master does not match any
error: failed to push some refs to 'https://github.com/JIANGE72/testgit.git'
后来根据创建空仓库的时候人家git上有提示
根据提示把箭头指向的命令敲一遍,就会把本地的仓库推给github上啦,具体操作如下:
jiang@DESKTOP-H9PNI47 MINGW64 /d/File/Git (master)
$ echo "# testgit" >> README.md
jiang@DESKTOP-H9PNI47 MINGW64 /d/File/Git (master)
$ git init
Reinitialized existing Git repository in D:/File/Git/.git/
jiang@DESKTOP-H9PNI47 MINGW64 /d/File/Git (master)
$ git add README.md
warning: LF will be replaced by CRLF in README.md.
The file will have its original line endings in your working directory
jiang@DESKTOP-H9PNI47 MINGW64 /d/File/Git (master)
$ git commit -m "first commit"
[master (root-commit) 0ea10c9] first commit
4 files changed, 5 insertions(+)
create mode 100644 README.md
create mode 100644 b.txt
create mode 100644 readme.txt
create mode 100644 test.txt
jiang@DESKTOP-H9PNI47 MINGW64 /d/File/Git (master)
$ git remote add origin https://github.com/JIANGE72/testgit.git
fatal: remote origin already exists.
jiang@DESKTOP-H9PNI47 MINGW64 /d/File/Git (master)
$ git remote rm origin
jiang@DESKTOP-H9PNI47 MINGW64 /d/File/Git (master)
$ git remote add origin https://github.com/JIANGE72/testgit.git
jiang@DESKTOP-H9PNI47 MINGW64 /d/File/Git (master)
$ git push -u origin master
Enumerating objects: 6, done.
Counting objects: 100% (6/6), done.
Delta compression using up to 8 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (6/6), 368 bytes | 368.00 KiB/s, done.
Total 6 (delta 0), reused 0 (delta 0), pack-reused 0
To https://github.com/JIANGE72/testgit.git
* [new branch] master -> master
Branch 'master' set up to track remote branch 'master' from 'origin'.
更多推荐
已为社区贡献1条内容
所有评论(0)