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 :: remove directory and contents linux 
Shell :: redis install ubuntu 
Shell :: create empty file command prompt cmd 
Shell :: get large files 
Shell :: how to use compress zip cli linux 
Shell :: wsl start distro 
Shell :: remove .env file from git history 
Shell :: delete remote commit 
Shell :: how to copy my pub ssh key to server linux 
Shell :: git remote add 
Shell :: concatenate in bash the output of two commands 
Shell :: change name of branch github 
Shell :: how to open a folder using terminal 
Shell :: symbolic link wsl mnt 
Shell :: read the file from shell 
Shell :: get only file names from CMD 
Shell :: gitignore is not working 
Shell :: git force push after reset 
Shell :: how to install mvnw 
Shell :: github create repo from terminal 
Shell :: git add and commit all in just one line 
Shell :: umask 
Shell :: bash get absolute path 
Shell :: nvim config path 
Shell :: show git branch on terminal on mac 
Shell :: shrink directory name linux 
Shell :: sed between two patterns 
Shell :: git tag sort versions 
Shell :: docker format 
Shell :: how to update or upgrade sql server on ubuntu 
ADD CONTENT
Topic
Content
Source link
Name
1+7 =