-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathpush.js
More file actions
31 lines (28 loc) · 705 Bytes
/
Copy pathpush.js
File metadata and controls
31 lines (28 loc) · 705 Bytes
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
'use strict';
const Git = require('nodegit');
const common = require('./common');
const cnst = require('./constant');
let repo;
Git.Repository.open(cnst.cur_git_path)
.then((repoResult) => (repo = repoResult))
.then(() => Git.Remote.lookup(repo, 'origin'))
.then((remote) => {
return remote.push(
['refs/heads/master:refs/heads/master'],
{
callbacks: {
credentials: (url, userName) => {
return Git.Cred.userpassPlaintextNew(cnst.account, cnst.password);
},
certificateCheck: () => {
return 1;
}
}
}
);
})
.then(() => {
console.log('push done');
repo.free();
})
.catch((e) => console.log(e));