Skip to content

Commit edc25cb

Browse files
authored
Add example to create repository with an initial commit with empty README.md (#2333)
Related: #2330
1 parent c63c9a9 commit edc25cb

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

example/newrepo/main.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ var (
2424
name = flag.String("name", "", "Name of repo to create in authenticated user's GitHub account.")
2525
description = flag.String("description", "", "Description of created repo.")
2626
private = flag.Bool("private", false, "Will created repo be private.")
27+
autoInit = flag.Bool("auto-init", false, "Pass true to create an initial commit with empty README.")
2728
)
2829

2930
func main() {
@@ -40,7 +41,7 @@ func main() {
4041
tc := oauth2.NewClient(ctx, ts)
4142
client := github.NewClient(tc)
4243

43-
r := &github.Repository{Name: name, Private: private, Description: description}
44+
r := &github.Repository{Name: name, Private: private, Description: description, AutoInit: autoInit}
4445
repo, _, err := client.Repositories.Create(ctx, "", r)
4546
if err != nil {
4647
log.Fatal(err)

0 commit comments

Comments
 (0)