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 check command history in linux with date and time 
Shell :: apple logo in terminal 
Shell :: docker remove image 
Shell :: ionic capacitor android 
Shell :: how to delete a commit from a branch 
Shell :: check if a command exists 
Shell :: install docker compose ubuntu 
Shell :: send file netcat 
Shell :: powershell restart computer 
Shell :: install beekeeper ubuntu 
Shell :: pip install pytorch==1.4.0 
Shell :: shell comments 
Shell :: how to open sublime in linux 
Shell :: how to get git stash changes back 
Shell :: install redash ubuntu 20.04 
Shell :: The terminal process failed to launch: Path to shell executable "cmd.exe" does not exist. vscode 
Shell :: remove folder with content cmd 
Shell :: add a new line at the end of this file in powershell 
Shell :: install cherrypy 
Shell :: etherum for ubuntu 
Shell :: scp ubuntu 
Shell :: find exclude 
Shell :: bash grep for two terms in same line 
Shell :: reset gpg passphrase 
Shell :: install simplejwt django 
Shell :: install teamviewer ubuntu 18 
Shell :: how to go back to last git commit 
Shell :: brave installation ubuntu 
Shell :: how to reverse shell 
Shell :: install cypress dev only 
ADD CONTENT
Topic
Content
Source link
Name
2+2 =