There were genealogical records, kept “in the Temple” (probably actually in an adjunct building). The later lineages, from about David’s time, found in Chronicles and to a lesser extent in Kings, are excerpts from them. (It’s possible Matthew or Luke made reference to these as well.)
However, to answer the more general question, it becomes necessary to discuss “higher criticism” of the Bible. And this is something that a consensus of serious Bible scholars agree on, but which is strongly disagreed with by the evangelical and fundamentalist Christian conservatives. So: note the status is consensus reconstruction of original texts, not proven facts, with a strong objection from those who consider the Bible as inspired verbatim and inerrant.
Most of Genesis is story – call it myths and legends in the anthropological sense. Specifically: Adam and Eve; Cain and Abel; short snipped about Lamech; Noah; Abraham; Isaac; Jacob and Esau; Jacob and his children; Judah; Joseph. These stories were handed down in three traditions or sources: the Yahwist, the Elohist, and the Priestly. Each can be identified by internal clues and a characteristic style of storytelling.
At some point, probably after the Babylonian Exile, they were consolidated into the Book of Genesis, and the rest of the Torah, w3hich we have today (the Deuteronomist source is responsible for Deuteronomy and a few later books, but doesn’t enter into the Genesis accounts).
At that time, the various stories seem to have been joined together by the “toledoth” passages, with the characteristic opening phrase “These are the generations of…” So we have Cain and Abel, whose story presupposes a population around them, identified as Adam and Eve’s first two sons; we have Noah as the great-great-great-great-great-great-grandson of Adam; we have the catalog of nations descended from Noah’s three ons, and we have Abraham identified as the descendant of Noah’s son Shem by an identified genealogy. These appear to have been adopted and included by an editor in the Priestly tradition to provide a “frame story” in which the individual stories listed above are incorporated.
Accuracy? You could spend pages debating it, but the consensus is, not very.