question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

git.fetch documentation code example crashes

See original GitHub issue

When trying to run the code block on the git.fetch documentation webpage, I get the following error (happens in both Chrome and Firefox):

name: "TypeError"
message: "Cannot read property 'split' of null"
stack: "TypeError: Cannot read property 'split' of null
    at new b (https://unpkg.com/isomorphic-git@0.55.2/dist/bundle.umd.min.js:8:64118)
    at Function.from (https://unpkg.com/isomorphic-git@0.55.2/dist/bundle.umd.min.js:8:64353)
    at https://unpkg.com/isomorphic-git@0.55.2/dist/bundle.umd.min.js:8:28034
    at Generator.next (<anonymous>)
    at o (https://unpkg.com/isomorphic-git@0.55.2/dist/bundle.umd.min.js:8:27621)
    at s (https://unpkg.com/isomorphic-git@0.55.2/dist/bundle.umd.min.js:8:27823)"
fileName: undefined
lineNumber: undefined
columnNumber: undefined

I get the same error when trying to run git.fetch in the browser with my own project.

As a side note: is using git.fetch the recommended way of retrieving the commits of a large repository (large == many commits) in a paginated way, when the end goal is to compare files between adjacent commits in an efficient way?

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:1
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jcubiccommented, May 23, 2019

I think that you can’t just fetch the commits, you need to have git repository to do this, so you first need to clone the repo, or create new one and add remote and then fetch (not sure about the last one).

1reaction
kpjcommented, May 23, 2019

I think that neither .git/config nor .git/ exist, because I am trying fetch commits from a remote repository which does not exist locally. This is the relevant code:

import FS from '@isomorphic-git/lightning-fs'
const git = require('isomorphic-git')

const fs = new FS('fs', { wipe: true })
git.plugins.set('fs', fs)
const pfs = fs.promises

const dir = '/repo'
await pfs.mkdir(dir)

const res = await git.fetch({
  dir: dir,
  corsProxy: 'https://cors.isomorphic-git.org',
  url: repoUrl,
  ref: branch,
  singleBranch: true,

  depth: 1
})
Read more comments on GitHub >

github_iconTop Results From Across the Web

git-fetch Documentation - Git
When fetching, we promiscuously considered all tag updates from a remote to be forced fetches. Since Git version 2.20, fetching to update refs/tags/*...
Read more >
Git crash course — BOUT++ 4.4.2 documentation
For a full guide to using Git, see the git website or online tutorials. This manual just explains some basic ways to use...
Read more >
git pull fails "unable to resolve reference ... - Stack Overflow
One of the possible causes may be the system crash as I described in my answer. Many Git GUI applications periodically run Git...
Read more >
Troubleshooting Git - GitLab Docs
If this error occurs when cloning a large repository, you can decrease the cloning depth to a value of 1 . For example:...
Read more >
Git crash course — RetroGames documentation
In the git parlance, each teamate has a local repository, a given change is a commit (some modifications to the files + a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found