libgit2sharp

How can I ignore a specific file in LibGit2Sharp when I merge from one branch to another?

大兔子大兔子 提交于 2019-12-24 11:34:04
问题 How can I ignore a specific file in LibGit2Sharp when I merge from one branch to another? For example, I have a database.xml metadata file in the main branch, lets call it branch (A); But then I diverge to branch (B). I then make changes and commit to the database.xml file in branch A, this results in branch (B) being out of date. However, I want to keep the database.xml file from branch B and not merge it with branch A. How is this done in LibGit2Sharp? 回答1: Generally speaking, you want to:

How to apply diff rules of the languages in gitattributes

旧街凉风 提交于 2019-12-24 01:09:23
问题 For example, the .gitattributes file of lg2s has the line *.cs diff=csharp . the output of the codes using (var repo = new Repository(@"path\to\lg2s")) { var tree1 = repo.Lookup<Commit>("a845db9").Tree; var tree2 = repo.Lookup<Commit>("d677741").Tree; var patches = repo.Diff.Compare<Patch>(tree1, tree2); foreach (var patch in patches) { Console.WriteLine(patch.Patch); } } is (shortly) diff --git a/LibGit2Sharp/RepositoryStatus.cs b/LibGit2Sharp/RepositoryStatus.cs @@ -59,8 +59,8 @@ namespace

How to fetch change from Git using LibGit2Sharp?

ⅰ亾dé卋堺 提交于 2019-12-23 17:26:40
问题 The code below clone a Git url to a test directory. var url = @"http://abc-555.com/team/project-555.git"; var path = @"E:\temp_555"; var credential = new Credentials() { Username = "a8888", Password="88888888"}; var clonePath = Repository.Clone(url, path, credentials: credential); using (var repo = new Repository(clonePath)) { foreach (var branch in repo.Branches) { Console.WriteLine(branch.Name); } // somebody creates a new branch here, so I want to fetch it. repo.Fetch("origin"); foreach

clone a git repository with SSH and libgit2sharp

偶尔善良 提交于 2019-12-23 12:24:08
问题 I'm trying to use the library "libgit2sharp" to clone a repository via a SSH key and... I can't find anything... I can clone it via "https" but what I'd like to do is using an SSH key. It's really unclear if it is supported or not. 回答1: As of now, there is a SSH implementation using libssh2 library. You can find it here LibGit2Sharp - SSH You should add libgit2sharp-ssh dependency on you Project to be able to use it. It is available as a nugget: https://www.nuget.org/packages/LibGit2Sharp-SSH

clone a git repository with SSH and libgit2sharp

半腔热情 提交于 2019-12-23 12:21:13
问题 I'm trying to use the library "libgit2sharp" to clone a repository via a SSH key and... I can't find anything... I can clone it via "https" but what I'd like to do is using an SSH key. It's really unclear if it is supported or not. 回答1: As of now, there is a SSH implementation using libssh2 library. You can find it here LibGit2Sharp - SSH You should add libgit2sharp-ssh dependency on you Project to be able to use it. It is available as a nugget: https://www.nuget.org/packages/LibGit2Sharp-SSH

Is it possible to add parts of a file to Git index using libgit2?

落爺英雄遲暮 提交于 2019-12-23 01:45:19
问题 I am using libgit2, actually libgit2sharp, is there a way to add parts of a file similar to what add -p in CLI? I don't find anything from the documentation: http://libgit2.github.com/libgit2/#HEAD/group/index 回答1: This is neither implemented (yet) in libgit2 , nor in LibGit2Sharp . In order to make this happen sooner rather than later, I'd suggest you to open a feature request in the libgit2 tracker . 来源: https://stackoverflow.com/questions/9597663/is-it-possible-to-add-parts-of-a-file-to

Git stash on windows extremly slow compared to Libgit2

对着背影说爱祢 提交于 2019-12-22 06:29:21
问题 Recently I've been using git stash many times and I've been thinking that it is really slow, even on a new repository with a single file. I've read this question about git stash slowness and this other one and tried every answer to these questions but nothing actually works. For example I've done the following steps to reproduce it: git init touch file.txt vim file.txt (edit the file adding 2 lines) git add . git commit -m "Initial commit" vim file.txt (edit it again adding 1 line) time git

LibGit2Sharp: Fetching fails with “Too many redirects or authentication replays”

▼魔方 西西 提交于 2019-12-17 20:29:55
问题 Here's the code I'm using to fetch: public static void GitFetch() { var creds = new UsernamePasswordCredentials() {Username = "user", Password = "pass"}; var fetchOpts = new FetchOptions {Credentials = creds}; using (repo = new Repository(@"C:\project");) { repo.Network.Fetch(repo.Network.Remotes["origin"], fetchOpts); } } but it fails during fetch with the following exception: LibGit2Sharp.LibGit2SharpException: Too many redirects or authentication replays Result StackTrace: at LibGit2Sharp

How to get the patch of every changed file of a single commit?

喜夏-厌秋 提交于 2019-12-14 02:29:36
问题 I’m trying to get some information about the commit-history by mining a git-repository. I’m using the package libgit2sharp. So far, I got the commit-author, committer, sha-value, commit-date and the commit-message. My problem is to move through the repository-tree, to get the patch of all changed files of every single commit. Does anybody solve this problem before, or can help me? using (var repo = new Repository(@"path\to\.git")) { var commits = repo.Commits; Commit lastCommit = commits.Last

How to set proxy using libgit2sharp?

試著忘記壹切 提交于 2019-12-13 15:21:57
问题 I use libgit2sharp clone and faced "failed to send request: The operation timed out" when I am using corporate networking. If I use my own 3G networking, it can clone successfully. But after I use git config in command line and I can clone repository by command line, I still can't clone repository by the code.... could everyone teach me how to set proxy in the code or how to use this lib in proxy environment? Thanks! 来源: https://stackoverflow.com/questions/42920787/how-to-set-proxy-using