Golang git pulling repo

I am very new to golang I am trying to execute git pull from go program. I looked into native libraries and found https://github.com/src-d/go-git/ .

I have clone functions ect. but does not pull. Looking at the source, it seems like there is a function to pull

func (r *Repository) Pull(o *PullOptions) 

      

However, the compiler warns that its undefined. Can anyone point me to how I can do this or to an alternative library that supports both clone and pull?

+3


source to share


2 answers


You should create the repository structure by cloning the repo:

import {
  git "github.com/src-d/go-git"
}

repo, err := git.Clone(memory.NewStorage(), nil, &git.CloneOptions{
    URL: "https://github.com/src-d/go-siva",
})

      

And then by calling struct repo Pull.



err := repo.Pull(&git.PullOptions{
    RemoteName: "origin"
})

      

You cannot call directly git.Pull

.

+4


source


I don't know if they changed it or what, but the above example has a broken import line and the repo structure does not contain a Pull function. The whole example is broken



0


source







All Articles