我刚刚下载了libgit2sharp的nugget包.我发现即使是基本的操作也很难.
我有一个现有的git仓库(远程和本地).我只需要在它发生时提交新的更改并将其推送到远程.
我有下面的代码来解释我做了什么.
string path = @"working direcory path(local)";
Repository repo = new Repository(path);
repo.Commit("commit done for ...");
Remote remote = repo.Network.Remotes["origin"];
var credentials = new UsernamePasswordCredentials {Username = "*******", Password = "******"};
var options = new PushOptions();
options.Credentials = credentials;
var pushRefSpec = @"refs/heads/master";
repo.Network.Push(remote, pushRefSpec, options, null, "push done...");
Run Code Online (Sandbox Code Playgroud)
我应该在哪里指定远程网址?这也是做这些操作(提交和推送)的正确方法吗?
谢谢
我正在尝试使用服务帐户使用域范围委派来进行 Google Drive API 调用。我可以让身份验证工作,但不能让驱动器 api 调用工作。错误:在驱动器中创建文件时找不到文件
此外,在域范围委派之前,我通过与服务帐户共享驱动器文件夹来使其工作。但现在我希望它能够在不共享的情况下工作。
我想我需要在某个地方做一些 setServiceAccount 的事情。不确定那会发生在哪里。
const {google} = require('googleapis');
const auth = new google.auth.JWT(
client_email, null,
privateKey, ['https://www.googleapis.com/auth/drive']
);
const drive = google.drive({version: "v3", auth});
//drive.files.create({});
Run Code Online (Sandbox Code Playgroud)