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


            

            
                              
                                          

 

                                                                           
             

                                      
 
                                     

                         
                        
                                          
                                        
                         
 
package main

import (
	"os"

	"srcd.works/go-git.v4"
	. "srcd.works/go-git.v4/_examples"
)

// Example of how to open a repository in a specific path, and do a push to
// his 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 push options
	err = r.Push(&git.PushOptions{})
	CheckIfError(err)
}