aboutsummaryrefslogblamecommitdiffstats
path: root/_examples/push/main.go
blob: 01eceaebf6d17663bfd98f107710589c9ce0ee2f (plain) (tree)
1
2
3
4
5
6
7
8
9


            

            

                                                 

 

                                                                      
             

                                      
 
                                     

                         
                        
                                     
                                        
                         
 
package main

import (
	"os"

	"github.com/go-git/go-git/v5"
	. "github.com/go-git/go-git/v5/_examples"
)

// Example of how to open a repository in a specific path, and push to
// its default remote (origin).
func main() {
	CheckArgs("<repository-path>")
	path := os.Args[1]

	r, err := git.PlainOpen(path)
	CheckIfError(err)

	Info("git push")
	// push using default options
	err = r.Push(&git.PushOptions{})
	CheckIfError(err)
}