clone
Clone a repository
| param | type [= default] | description | 
|---|---|---|
| fs | FsClient | a file system implementation | 
| http | HttpClient | an HTTP client | 
| onProgress | ProgressCallback | optional progress event callback | 
| onMessage | MessageCallback | optional message event callback | 
| onAuth | AuthCallback | optional auth fill callback | 
| onAuthFailure | AuthFailureCallback | optional auth rejected callback | 
| onAuthSuccess | AuthSuccessCallback | optional auth approved callback | 
| onPostCheckout | PostCheckoutCallback | optional post-checkout hook callback | 
| dir | string | The working tree directory path | 
| gitdir | string = join(dir,'.git') | The git directory path | 
| url | string | The URL of the remote repository | 
| corsProxy | string | Optional CORS proxy. Value is stored in the git config file for that repo. | 
| ref | string | Which branch to checkout. By default this is the designated "main branch" of the repository. | 
| singleBranch | boolean = false | Instead of the default behavior of fetching all the branches, only fetch a single branch. | 
| noCheckout | boolean = false | If true, clone will only fetch the repo, not check out a branch. Skipping checkout can save a lot of time normally spent writing files to disk. | 
| noTags | boolean = false | By default clone will fetch all tags. noTagsdisables that behavior. | 
| remote | string = 'origin' | What to name the remote that is created. | 
| depth | number | Integer. Determines how much of the git repository's history to retrieve | 
| since | Date | Only fetch commits created after the given date. Mutually exclusive with depth. | 
| exclude | Array<string> = [] | A list of branches or tags. Instructs the remote server not to send us any commits reachable from these refs. | 
| relative | boolean = false | Changes the meaning of depthto be measured from the current shallow depth rather than from the branch tip. | 
| headers | Object<string, string> = {} | Additional headers to include in HTTP requests, similar to git's extraHeaderconfig | 
| cache | object | a cache object | 
| nonBlocking | boolean = false | if true, checkout will happen non-blockingly (useful for long-running operations blocking the thread in browser environments) | 
| batchSize | number = 100 | If args.nonBlocking is true, batchSize is the number of files to process at a time avoid blocking the executing thread. The default value of 100 is a good starting point. | 
| return | Promise<void> | Resolves successfully when clone completes | 
Example Code:
await git.clone({
  fs,
  http,
  dir: '/tutorial',
  corsProxy: 'https://cors.isomorphic-git.org',
  url: 'https://github.com/isomorphic-git/isomorphic-git',
  singleBranch: true,
  depth: 1
})
console.log('done')
Tip: If you need a clean slate, expand and run this snippet to clean up the file system.
window.fs = new LightningFS('fs', { wipe: true })
window.pfs = window.fs.promises
console.log('done')