git2-rs icon indicating copy to clipboard operation
git2-rs copied to clipboard

push credentials on github actions

Open jdrouet opened this issue 1 year ago • 1 comments

👋 Hey! First, thank you for this wonderful project. I'm writing here because I'm trying to write a git extension called git-metrics which would allow to store metrics regarding the project, inside git notes, with a simple CLI, so that we don't need to rely on external services. I have some commands working (add, remove, show) but when it comes to push and pull, it becomes a bit more tricky considering it involves some authentication. In this PR, I'm trying to use git-metrics push to push my notes, directly from a github action. Using git, we just need to do git push origin refs/notes/metrics and the authentication works out of the box. With git2, the authentication doesn't seem to work. Does anyone know, what is the proper way to authenticate using git2 on github actions? Thank you

jdrouet avatar May 17 '24 06:05 jdrouet

Hey,

Its hard to make assumptions as you haven't given any error codes or anything that hasn't worked for you. I would imagine however that using this section from the docs might help.

Using the RepoBuilder it seems as though you can make a Repository object which represents your repo. Once you have your Repository object you can use this function to get the remote you want to push to. From there you have a remote object which looks like it allows you to push & pull.

As for github actions, I'm not entirely sure how you would go about implementing calling those but I'm sure you can figure it out.

Cheers.

Some1and2-XC avatar Jul 17 '24 13:07 Some1and2-XC