Reputation: 2059
I need to upload an existing project to my own repository
Preconditions:
Steps:
I followed the given instruction from the git:
git init
git remote add origin https://...`
git branch -M main
git push -uf origin main
Error:
error: src refspec main does not match any
error: failed to push some refs to 'https://gitlab.com/../...-main.git'
Additional info:
I have established the ssh
connection with my repository and successfully used git on the other projects.
I also was trying the option with git remote add origin [email protected]:..../...-main.git
but received the same result
How to resolve this issue?
Upvotes: 2
Views: 5254
Reputation: 11
The error usually occurs when Git can’t find the master branch to push to, often caused by:
Upvotes: 1
Reputation: 82
double-check you have the remote added with
git remote -v
you should see your remote repository url, then try
git fetch origin main
instead of pushing.
you can push once do the fetching.
Upvotes: 1