-2
$ git show-ref
$ git push origin HEAD:main
error: src refspec HEAD does not match any.
error: failed to push some refs to 'https://github.com/ShridharMP/SpringBoot.git'
Joachim Sauer
  • 302,674
  • 57
  • 556
  • 614
Shridhar
  • 3
  • 1

2 Answers2

1

Hey there it looks like your question was already. Please try this. If your sure your project is linked to git repository. git add . run this to see whether your code is added/staged git status Then commit your code with the command bellow git commit -m "put your message here" Then make sure you push your code to the branch you want it to be with this commad git push origin <branch here>

You may also checkout this question here. Message 'src refspec master does not match any' when pushing commits in Git

MUGABA
  • 751
  • 6
  • 7
-1

After adding the untracked files this issue got resolved for me

Shridhar Patil@ShridharMP MINGW64 /d/SpringBoot/DerivedMethodApplication (main)
$ **

> git status

**
On branch main

No commits yet

Changes to be committed:
  (use "git rm --cached <file>..." to unstage)

        new file:   .gitignore
        new file:   .mvn/wrapper/MavenWrapperDownloader.java
        new file:   .mvn/wrapper/maven-wrapper.jar
        new file:   .mvn/wrapper/maven-wrapper.properties

Untracked files:
  (use "git add <file>..." to include in what will be committed)

        **mvnw
        mvnw.cmd
        pom.xml
        src/**

Shridhar Patil@ShridharMP MINGW64 /d/SpringBoot/DerivedMethodApplication (main)
$ 

> git add mvnw

warning: LF will be replaced by CRLF in mvnw.
The file will have its original line endings in your working directory

Shridhar Patil@ShridharMP MINGW64 /d/SpringBoot/DerivedMethodApplication (main)
$ **

> git add mvnw.cmd

**
warning: LF will be replaced by CRLF in mvnw.cmd.
The file will have its original line endings in your working directory

Shridhar Patil@ShridharMP MINGW64 /d/SpringBoot/DerivedMethodApplication (main)
$ **

> git add pom.xml

**
warning: LF will be replaced by CRLF in pom.xml.
The file will have its original line endings in your working directory

Shridhar Patil@ShridharMP MINGW64 /d/SpringBoot/DerivedMethodApplication (main)
$ **

> git add src/

**
warning: LF will be replaced by CRLF in src/main/java/com/example/person/DerivedMethodApplication.java.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in src/main/resources/application.properties.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in src/test/java/com/example/ticketbookingapplication/DerivedMethodApplicationTests.java.
The file will have its original line endings in your working directory

$ **

> git commit -m "first commit"

**
[main (root-commit) 6562ff5] first commit
 14 files changed, 1156 insertions(+)
 create mode 100644 .gitignore
 create mode 100644 .mvn/wrapper/MavenWrapperDownloader.java
 create mode 100644 .mvn/wrapper/maven-wrapper.jar
 create mode 100644 .mvn/wrapper/maven-wrapper.properties
 create mode 100644 mvnw
 create mode 100644 mvnw.cmd
 create mode 100644 pom.xml
 create mode 100644 src/main/java/com/example/person/DerivedMethodApplication.java
 create mode 100644 src/main/java/com/example/person/dao/PersonDAO.java
 create mode 100644 src/main/java/com/example/person/model/Person.java
 create mode 100644 src/main/java/com/example/person/model/PersonDTO.java
 create mode 100644 src/main/java/com/example/person/service/PersonService.java
 create mode 100644 src/main/resources/application.properties
 create mode 100644 src/test/java/com/example/ticketbookingapplication/DerivedMethodApplicationTests.java

Shridhar Patil@ShridharMP MINGW64 /d/SpringBoot/DerivedMethodApplication (main)
$ **

> git push -u origin main

**
Enumerating objects: 33, done.
Counting objects: 100% (33/33), done.
Delta compression using up to 4 threads
Compressing objects: 100% (24/24), done.
Writing objects: 100% (33/33), 55.51 KiB | 507.00 KiB/s, done.
Total 33 (delta 2), reused 0 (delta 0)
remote: Resolving deltas: 100% (2/2), done.
Joachim Sauer
  • 302,674
  • 57
  • 556
  • 614
Shridhar
  • 3
  • 1