Questions tagged [go-git]

Highly extensible implementation of Git protocol and storage format in Golang

go-git is is highly extensible implementation of Git protocol and storage format in Go.

It aims to reach the completeness of libgit2 or jgit, and nowadays covers the majority of the plumbing read operations and some of the main write ones, but lacks the main porcelain operations such as merges.

In its design, it has been following the open/close principle to facilitate extensions, mainly focusing the efforts on the persistence of the objects.

57 questions
0
votes
1 answer

Unable to run https git clone using go-git and access token

Using go-git/v5 and trying to clone over https as follows: _, err := git.Clone(memory.NewStorage(), fs, &git.CloneOptions{ URL: repo, ReferenceName: plumbing.ReferenceName(branch), Depth: 1, …
pkaramol
  • 16,451
  • 43
  • 149
  • 324
0
votes
1 answer

How to checkout latest release tag

I'm aware of how to checkout a specific commit or branch using Checkout(&git.checkoutOptions) with plumbing.ReferenceName("") or plumbing.Hash(""), but I want to be able to clone a specific release version. Any ideas on how…
moho1357
  • 3
  • 3
0
votes
0 answers

go-git get tree from lightweight tag

I'm trying to get the tree of files from a git tag and everything worked just fine until I found out some tags are not annotated and hence not a TagObject This is my current code: var obj *plumbing.Reference obj, err =…
0
votes
1 answer

go-git equivalent to "git push --all "

Having trouble finding a way to push all branches to a remote using go-git without iterating all branches. I've looked at the PushOptions definition, and I'm not seeing an option that correlates to git push --all . Has anyone accomplished…
JTW
  • 3,546
  • 8
  • 35
  • 49
0
votes
1 answer

go-git reports a file as Untracked while it should be Unmodified

I am trying to check the status of a particular file in a git repo using go-git library. This is the code I am attempting to run: repo, err := git.PlainOpen(fullPathToRepo) if err != nil { return false, fmt.Errorf("ERROR: Unable to…
pkaramol
  • 16,451
  • 43
  • 149
  • 324
0
votes
1 answer

Unknown status type returned by go-git

I am trying to get the status of a file checked in a git repo using go-git library. So I am running this code snippet: var status = git.Status{} var fileStatus *git.FileStatus fileStatus = status.File(fullPathToApp) …
pkaramol
  • 16,451
  • 43
  • 149
  • 324
0
votes
2 answers

Pushing to a remote with basic authentication

I'm currently struggling to get go-git working with private repositories on GitHub. Although working with the git command line works as expected (git push origin), the code snippet below does not work. The last log command returns the following…
nachtjasmin
  • 386
  • 4
  • 13
0
votes
1 answer

How to identify which files have changed between git commits

How can we use go-git to generate a list of all the files that have changed between two commits similar to git diff --name-only commit1 commit2? For context, we have a git monorepo that contains a single root go.mod file but multiple Go…
SteveCoffman
  • 983
  • 1
  • 8
  • 22
0
votes
1 answer

How to resolve commit into branches?

I need to find all branches (tags) with a commit. On CLI using git command it's possible by using git branch --contains command. How do to something like that using go-git library?
Alex Raeder
  • 661
  • 6
  • 10
0
votes
1 answer

In-memory repository disappears when returned from function

I'm using go-git in a program and trying to test my functions. To test one function I want to first create an in-memory repository, commit a file to it and then let my function use it. So, in my test i wrote a helper that can create a new in-memory…
fiskeben
  • 3,395
  • 4
  • 31
  • 35
-1
votes
2 answers

How to create Pull request or merge PR

I'm able to clone fetch push to a repo. Similarly Is it possible to create pull request or merge PR using Go? "gopkg.in/src-d/go-git.v4"
mnvbrtn
  • 558
  • 1
  • 8
  • 27
-3
votes
1 answer

How to checkout a specific SHA in a git repo using golang

I need help in check out the code upto a specific SHA number of git repo using golang
Susai
  • 1
  • 1
1 2 3
4