javascript - 如何连接到 git repo 并使用 nodegit 创建分支?
问题描述
我正在尝试通过想要动态创建分支的代码连接到我的 git 存储库,使用 nodegit 来完成此任务,它抛出错误 No file or directory found。
需要使用 nodegit 完成以下任务的帮助:
1-通过传递我的凭据连接到 git repo
2-创建一个分支并将其设置为上游
打开.js
Git.Repository.open(path.resolve(__dirname, "https://gitw.dgital-1.com/digital//myproject"))
.then(function(repo) {
// Create a new branch on head
console.log("REPO", repo);
return repo.getHeadCommit()
.then(function(commit) {
return repo.createBranch(
"new-branch",
commit,
0);
});
});
解决方案
推荐阅读
- swift - 更新到 Xcode 12 后,“Messaging”类型的值没有成员“shouldEstablishDirectChannel”
- python - 从预订中返回最受欢迎的设施?
- android - GPS跟踪的前台服务在一段时间后停止工作
- vue.js - Vuetify 数据表 v-model 对表项内部的更改没有反应
- jsp - jboss/wildfly - 在 Web 容器外提供 xml 文件
- linux - 在 Linux-5.11.4 中跟踪 softirq_raise 的跟踪点失败
- mysql - 在 SSIS 中从 MySQL 到 SQL 的数据转换
- ios - UIView 转换为 UIImage 时如何使用自动布局
- chart.js - 水平线内容与轴重叠:Chart.js
- android - Android ImageFormat 大小对比