Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

error: src refspec master does not match any

#Try git show-ref to see what refs you have. Is there a refs/heads/master?
#Due to the recent "Replacing master with main in GitHub" action, 
#you may notice that there is a refs/heads/main. As a result, 
#the following command may change 
#from ---> git push origin HEAD:master
#to   ---> git push origin HEAD:main

#You can try 
git push origin HEAD:master 
#as a more local-reference-independent solution. This explicitly states
#that you want to push the local ref HEAD to the remote ref master 
#(see the git-push refspec documentation).
Comment

error: src refspec master does not match any. git

# You are trying to add an empty repository, add something first, like a readme
touch README.md
git add README.md
git commit -m "Initial commit"
git push --set-upstream origin master
Comment

error: src refspec master does not match any.

git init
git add .
git commit -m "first commit"
git branch -M main
git remote add origin "_git repository link here_"
git push -u origin main
Comment

src refspec main does not match any

git init

git add .

git commit -m "YOUR FIRST MESSAGE HERE"

git branch -M main

git remote add origin _GIT_LINK_TO_PROJECT_HERE_

git push -u origin main
Comment

src refspec main does not match any

git init
git add .
git commit -m "first commit"
git branch -M main
git remote add origin "_git repository link here_"
git push -u origin main

"main" is the usual branch name in Github repos. In some repos, it can be master or some other name
use the following command at that time
git push origin master 
Comment

error: src refspec master does not match any

Try git show-ref to see what refs you have. Is there a refs/heads/master?
Due to the recent "Replacing master with main in GitHub" action, 
you may notice that there is a refs/heads/main. 
As a result, the following command may change from git push origin HEAD:master 
to git push origin HEAD:main

So try `git push origin main`
Comment

error: src refspec master does not match any.

git config --global user.email "you@example.com"

git config --global user.name "Your Name"
Comment

error: src refspec master does not match any.

git push origin main
Comment

src refspec main does not match any

### Maybe you just need to commit. I ran into this when I did:###

mkdir repo && cd repo
git remote add origin /path/to/origin.git
git add .
## Oops! Never committed!##

git push -u origin master
error: src refspec master does not match any.
### All I had to do was: ###

git commit -m "initial commit"
git push origin main
### Success! ###
Comment

error: src refspec master does not match any

# find the right branch: master or main
# newer git repos start with main
git push origin main
# to switch head branch:
git branch -M main
Comment

error: src refspec master does not match any.

git init
git add . //to add everything
git commit -m ''
git remote -v
git push heroku master
Comment

error: src refspec develop does not match any

git push -u -f origin HEAD:develop
Comment

PREVIOUS NEXT
Code Example
Shell :: Permission denied (publickey,keyboard-interactive). 
Shell :: redis download 
Shell :: run bash script linux with sudo password 
Shell :: bash get current process id 
Shell :: powershell convert to json 
Shell :: flutter cmdline-tools component is missing 
Shell :: uninstall utorrent buntu 
Shell :: PowerShell command list software windows server 2016 
Shell :: how to put files into gitignore 
Shell :: brew update package 
Shell :: rstudio find out if package is installed 
Shell :: git bash terminal weird characters 
Shell :: how to open a file using terminal and exit terminal 
Shell :: install express 
Shell :: install .net framework 3.5 from windows 
Shell :: CMake Error at src/CMakeLists.txt:10 (find_package): By not providing "FindOpenCV.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "OpenCV", but CMake did not find one. 
Shell :: merge git branch 
Shell :: how to restore a mongodb dump with a new name 
Shell :: supertest example 
Shell :: patch: command not found 
Shell :: bash check if command is available 
Shell :: how to rename a file in terminal 
Shell :: how to install pip ubuntu python2 
Shell :: removing a git folder 
Shell :: Kubernetes configuration file is group readable 
Shell :: linux chmod permissions 
Shell :: delete git branch 
Shell :: git clone to existing folder 
Shell :: revert unstaged changes git 
Shell :: set java home in ubuntu 
ADD CONTENT
Topic
Content
Source link
Name
2+1 =