59 questions
-1
votes
1
answer
256
views
How to truncate git commit history to reduce object count?
I have a Git server service implemented based on go-git, and the repository has multiple copies on different machines. When a machine goes down and is replaced, I perform a full clone of the ...
0
votes
2
answers
109
views
cheapest way to describe a git hash
I need to get the same result of git describe <hash> for remote repository.
For example, given the hash d96edbcf, I want to get something like v0.54.0-1-gd96edbcf
I need to this for multiple ...
1
vote
1
answer
378
views
How to check for uncommitted changes in the working area using go-git
I'm currently working on a web editor integrated with Git using the go-git library. I'm looking for a way to programmatically check for modifications in the working area before adding files to a ...
2
votes
0
answers
50
views
How to set up an initial repository with some branches to operate on?
I've been chipping away at trying to better understand how to set up the initial state of a test within my application. The initial setup that I need is fairly minimal:
Set up a git repository for my ...
1
vote
2
answers
938
views
git repo url is appended with /git-upload-pack on using go-git's Plainclone function
Trying to clone a repo from Azure devops.
func (gitopt *GitOptions) clone() (*git.Repository, error) {
r, err := git.PlainClone(gitopt.RepoDir, false, &git.CloneOptions{
Progress: os....
2
votes
0
answers
386
views
Clone partial git repo with go-git
My golang application needs to list all file and folder paths in a subfolder of a git repo (a search path). I only care about the HEAD commit. I'm using the go-git library to clone the repo and ...
3
votes
1
answer
2k
views
How to push specific branch to remote with go-git
What is the canonical way to push specific single local branch to specific remote with go-git?
I have a local repository checked out and opened with go-git
repo, err := git.PlainOpen("my-repo&...
2
votes
1
answer
4k
views
In Go Git, how to authenticate using the SSH agent?
I've set up Git with SSH following https://docs.github.com/en/authentication/connecting-to-github-with-ssh; specifically, I've added my key to the SSH agent following https://docs.github.com/en/...
1
vote
1
answer
410
views
what is the difference between git and go-git
My application use go-git library and I recently became aware of CVE-2022-23521
, CVE-2022-41903 issues about git.
I want to know if these issues affect go-git (https://github.com/go-git/go-git).
This ...
1
vote
0
answers
115
views
How do I do the equivalent of `git remote set-branches origin --add other-branch` in go-git?
I have a huge repository with extensive commit history. To reduce clone time, I do a single branch option with a depth of 1. This immensely speeds up my cloning time however, it cannot properly ...
2
votes
1
answer
2k
views
go-git checkout failing with reference not found
I'm just starting to use the go-git library and so far it looks very promising.
However, I'm trying to do a basic checkout of an existing branch and it is failing with "reference not found".
...
0
votes
1
answer
5k
views
Argocd ApplicationSet, Git Generator error during fetching repo
Tested a official test code in a Argo CD reference.
https://argo-cd.readthedocs.io/en/stable/operator-manual/applicationset/Generators-Git/
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
...
1
vote
0
answers
129
views
How to use PathFilter correctly in go-git?
I am trying to analyze the git commit log by using go-git. But I encountered some problems and failed to solve them after many attempts.
In WSL(Ubuntu18.04), the command root@(XXXXXXX/XXXXXX):.../www/...
1
vote
1
answer
1k
views
How to checkout a specific single file to inspect it using go-git?
I want to clone a specific repository, fetch all tags and iterate through them. For each tag I want to checkout a specific file ( package.json ) in the root directory. If no file is present, it should ...
0
votes
1
answer
440
views
go-git: Create short hash (a83ad00 instead of a83ad004b3c5...)
I am using go-git and I would like to print the short hash.
I mean, for example "a83ad00" instead of "a83ad004b3c5971a194ba86b96fe313b94bbcde7".
I looked at the source code of got-...