Having trouble in running a go-git api example

67 views
Skip to first unread message

PK

unread,
Oct 13, 2022, 5:51:26 AM10/13/22
to golang-nuts
Hi,
I am trying to run example provided here(https://github.com/go-git/go-git/tree/master/_examples)

1) firstly I run the clone example by cloning a repo(https://github.com/go-git/go-git/blob/master/_examples/clone/auth/basic/access_token/main.go). (it was successful)

2) Then I run the commit example by creating a file.(https://github.com/go-git/go-git/blob/master/_examples/commit/main.go) it was successful.

3) Now I want to push that file to git repo. but I am not able to understand what argument i should give along with the go executable file.(https://github.com/go-git/go-git/blob/master/_examples/push/main.go)

Can anyone please help me this.
Thank you.

go je

unread,
Oct 13, 2022, 7:30:59 AM10/13/22
to PK, golang-nuts
if you mean os.Args[1], you might want to build it first using "go build" and you might run "./push https://github.com/go-git/go-git".
if you don't build the executable, the default args might be `[]string{"go", "run", "_examples/push/main.go", "https://github.com/go-git/go-git"}` where "os.Args[1]" is "run" and "os.Args[3]" is "https://github.com/go-git/go-git "

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/81a55c30-9282-4982-89dd-c71d673f7b34n%40googlegroups.com.

TECHAX

unread,
Oct 13, 2022, 9:15:17 AM10/13/22
to eta_...@gmail.com, golang-nuts
Thank you, lets say I have cloned a different rep and locally committed a file to that repo's default branch, now wat to push that. So I should run 
./push url_of_that_repo,  but it is not working.
Reply all
Reply to author
Forward
0 new messages