FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
nodegit-example/clone.js at master · thorgits/nodegit-example · GitHub
thorgits
nodegit-example
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
nodegit-example
/
clone.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
39 lines (36 loc) · 846 Bytes
Breadcrumbs
nodegit-example
/
clone.js
Copy path
File metadata and controls
39 lines (36 loc) · 846 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
'use strict'
;
const
Git
=
require
(
"nodegit"
)
;
const
pkg
=
require
(
'./package'
)
;
const
cnst
=
require
(
'./constant'
)
;
const
Clone
=
Git
.
Clone
.
clone
;
/*
if you use not NFS filesystem, error would comes to you!
-----------------------
Failed to mmap. Could not write data: Invalid argument
Error: Failed to mmap. Could not write data: Invalid argument
at Error (native)
-----------------------
help from GitHub: https://github.com/nodegit/nodegit/issues/1115
it's the filesystem cause it
*/
let
cloneOptions
=
{
}
;
cloneOptions
.
fetchOpts
=
{
callbacks
:
{
certificateCheck
:
(
)
=>
{
return
1
;
}
}
}
;
// 复制当前repo仓库
Clone
(
pkg
.
repository
.
url
,
`
${
cnst
.
tmp_dir
}
/
${
pkg
.
name
}
`
,
cloneOptions
)
.
then
(
(
repo
)
=>
{
console
.
log
(
'repo done!'
)
;
}
)
.
catch
(
(
e
)
=>
{
console
.
log
(
e
.
message
)
;
console
.
log
(
e
.
stack
)
;
}
)
;
Back
|
FazBrowse Home
|
New Git URL