简体   繁体   中英

Git Push Errors when pushing to Github

I have been tirelessly trying to push a file to Github from Git. From incomplete loading processes to duplicate files--I need some serious help trying to rectify this issue.

The following are the error messages received:

$ git push origin master
error: src refspec master does not match any.
error: failed to push some refs to 'https://github.com/XXXX/REPOSITORYNAME.git'

And...

If no other git process is currently running, this probably means a
git process crashed in this repository earlier. Make sure no other git
process is running and remove the file manually to continue.

And finally...

$ git add .
fatal: Unable to create 'C:/Users/XXXXX/.git/index.lock': File exists.

The solution for your final problem could be:

In windows: command prompt from repository directory, in your case C:/Users/username/

cd .git
del index.lock

I'm assuming that your repo is not 'https://github.com/xxxx/REPOSITORYNAME.git'? Your origin master is set to this url. Switch it to the correct origin

git remote set-url origin git://new.url.here

I got the error error: src refspec master does not match any when I did a push without committing. So all I had to do was to commit some files and then

git push -u origin master

This simply tells to remove index.lock file from the working tree and from the index in linux/unix/gitbash/cygwin.

rm -f .git/index.lock

If the above didn't work try this one below.

rm .git/index.lock

That's it that will do the trick

If it is Windows Command Prompt, try:

del .git\index.lock

if your git has crashed, then you have to run a

git reset

after you remove your index.lock file

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM