Yocto build broken due to branch deletion on github

I had this same problem - the socfpga-4.1.22-ltsi build was failing after the branches were deleted. The failure was due to a bug in the Altera bitbake recipes. The recipe was not setting the SRCREV_machine variable, so the default value was causing the do_patch function to run git ls-remote on the upstream repository. I worked around the issue by setting

 SRCREV_machine ?= "${SRCREV}"

immediately after the SRCREV assignment in
meta-altera/recipes-kernel/linux/linux-altera-ltsi_4.1.22.bb

This stopped the build from trying to access the remote repository. Your 4.2 recipe is probably doing the same thing.

Altera does not seem to be responding to any posts or questions related to the removal of these branches. Another post (Why all the tags where removed from altera-opensource/linux-socfpga?) claimed, without reference, that it was because of the Spectre/Meltdown CVEs, but I haven’t seen any verification from Altera about this.