Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git Fatal Error: "refs not found"

I have an empty repository created and initialized it awhile ago. I've been trying to make commits and push them but weird things are happening.

1) I'll do 'git status' in the folder I want and see all the untracked files. Then, I'll do 'git add [file]'. Then, again, I will do 'git status' but the file I just added does not show up at all - not in new files, tracked files, or untracked files - it's just gone.

2) When I try to do 'git push origin master', I get the message

fatal: "https://github.com/*****/******.git/info/refs not found: did you run git update-server-info on the server?"

What is going on???

like image 233
bmay2 Avatar asked May 11 '26 23:05

bmay2


2 Answers

Your repository is corrupted; it sounds like the refs folder has been deleted by accident. Fortunately, if you haven't made any commits, then you haven't really lost anything; just delete .git, then git init again, and you should be able to commit.

Also, note that if this is a GitHub repo, and you've changed your GitHub id between the time you created the repo and the time you tried to push, that's another reason for seeing the refs-not-found error.

like image 68
John Feminella Avatar answered May 13 '26 13:05

John Feminella


Alright so more errors kept coming up, but I figured out a way to solve it...

After deleting the repository on my git page, I readded it, then initialized the repository, did

git remote add origin3 https://github.com/[user]/[repo].git

and then did a

git pull origin3 master

(I'm guessing that had retrieved previous commits I made?). I tried to do

git push origin3 master

but I got a fatal 403 (HTTP request) error so I did this little diddy:

git remote set-url origin ssh://[email protected]/[user]/[repo].git

then

git push origin master

and I was golden.

like image 26
bmay2 Avatar answered May 13 '26 12:05

bmay2



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!