1package main
2
3import (
4 "os"
5
6 "github.com/go-git/go-git/v5"
7 . "github.com/go-git/go-git/v5/_examples"
8)
9
10// Example of how to open a repository in a specific path, and push to
11// its default remote (origin).
12func main() {
13 CheckArgs("<repository-path>")
14 path := os.Args[1]
15
16 r, err := git.PlainOpen(path)
17 CheckIfError(err)
18
19 Info("git push")
20 // push using default options
21 err = r.Push(&git.PushOptions{})
22 CheckIfError(err)
23}