Closed FilipChalupa closed 7 years ago
.then(() => { return nodegit.Repository.init(path, 0) .then((r) => repo = r) .then(() => nodegit.Remote.create(repo, 'origin', trimmedUrl)) //.then(() => exec(`cd ${path} && git push --set-upstream origin master`)) .then(() => repo.refreshIndex()) .then((index) => index.writeTree()) .then((oid) => { const author = repo.defaultSignature() return repo.createCommit('HEAD', author, author, 'Init', oid, []) }) //.then(() => repo.getHeadCommit()) //.then((c) => console.log(c)) .then((headCommit) => nodegit.Branch.create(repo, 'master', headCommit, 1)) .then((currentBranch) => nodegit.Branch.setUpstream(currentBranch, 'origin')) .catch((error) => { console.warn(error) errorMessage = 'Projekt se nepodařilo vytvořit' throw new Error('Unable to init repository.') }) })