Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

davy_yg's avatar
Level 27

fatal: couldn't find remote ref main

I tried to git pull from server:

	[advancew@sjc02 zws_framework_2]$ ls
	[advancew@sjc02 zws_framework_2]$ git pull origin main
	fatal: couldn't find remote ref main
	[advancew@sjc02 zws_framework_2]$ git branch -vv
	[advancew@sjc02 zws_framework_2]$

ref: https://stackoverflow.com/questions/11552437/git-pull-remote-branch-cannot-find-remote-ref

Can't understand this error message: fatal: couldn't find remote ref main

0 likes
9 replies
Nakov's avatar

So probably the branch is not called main but something else, master maybe?

git pull origin master
davy_yg's avatar
Level 27

I am using gitlab and the branch is called main

davy_yg's avatar
Level 27
	[advancew@sjc02 zws_framework_2]$ git remote -v
	origin  .git/ (fetch)
	origin  .git/ (push)
	[advancew@sjc02 zws_framework_2]$ git pull origin main
	fatal: couldn't find remote ref main
Sinnbeck's avatar

@davy_yg So you don't have a remote? git remote set-url origin git@yourgitrepourl:yourrepo

Perhaps check on a computer where it works.

davy_yg's avatar
Level 27

I tried using other laptop and it shows the same error message.

	[advancew@sjc02 zws_framework_2]$ git pull origin main
	fatal: protocol 'git@https' is not supported
Sinnbeck's avatar

@davy_yg So get the correct one from gitlab. I am sure there it tells you the clone command somewhere, and there you can see the repo url

Please or to participate in this conversation.