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 main does not match any

git merge --allow-unrelated-histories origin/main
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

error: src refspec working does not match any

git push origin HEAD:<remoteBranch> 
Comment

error: src refspec main does not match any

"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

PREVIOUS NEXT
Code Example
Shell :: how to install powerline for ubuntu 
Shell :: edit file terminal 
Shell :: github error “Commit your changes or stash them before you can merge”? 
Shell :: adb install apk 
Shell :: how to commit single file in git 
Shell :: download google chrome linux command line rpm 
Shell :: run zipkin-server on docker 
Shell :: how to enable bluetooth on terminal 
Shell :: install python 3.10 linux (multiple python versions) 
Shell :: linux custom command 
Shell :: github page 404 
Shell :: No package mongodb-org available. 
Shell :: tkcalendar install 
Shell :: how to install grub 
Shell :: pupeteer install ubuntu 
Shell :: git github private fatal repository not found 
Shell :: get new instagram posts by hashtag 
Shell :: docker install linux mint 
Shell :: install neofetch on ubuntu 
Shell :: delete commit from pr 
Shell :: The "@angular/compiler-cli" package was not properly installed. 
Shell :: windows 10 sfc scan 
Shell :: list groups of an user linux 
Shell :: apache start stop restart 
Shell :: access wsl files from windows explorer 
Shell :: echo  
Shell :: brew mac 
Shell :: git commit not showing up in github 
Shell :: how to verify my ssh key password 
Shell :: how to install discord on linux 
ADD CONTENT
Topic
Content
Source link
Name
1+7 =