Skip to content

Commit de1a0aa

Browse files
committed
Add insecure flag
1 parent f85018a commit de1a0aa

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,15 @@ Usage: git-backup
7979

8080
Options:
8181
-backup.path string
82-
The target path to the backup folder. (default "backup")
82+
The target path to the backup folder. (default "backup")
8383
-config.file string
84-
The path to your config file. (default "git-backup.yml")
84+
The path to your config file. (default "git-backup.yml")
8585
-backup.fail-at-end
8686
Fail at the end of backing up repositories, rather than right away.
8787
-backup.bare-clone
8888
Make bare clones without checking out the main branch.
89+
-insecure
90+
Use this flag to disable verification of SSL/TLS certificates
8991
-version
9092
Show the version number and exit.
9193
```

cmd/git-backup/main.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
package main
22

33
import (
4+
"crypto/tls"
45
"flag"
56
gitbackup "git-backup"
67
"log"
8+
"net/http"
79
"os"
810
"path/filepath"
911
"runtime"
@@ -15,20 +17,26 @@ var targetPath = flag.String("backup.path", "backup", "The target path to the ba
1517
var failAtEnd = flag.Bool("backup.fail-at-end", false, "Fail at the end of backing up repositories, rather than right away.")
1618
var bareClone = flag.Bool("backup.bare-clone", false, "Make bare clones without checking out the main branch.")
1719
var printVersion = flag.Bool("version", false, "Show the version number and exit.")
20+
var enableInsecure = flag.Bool("insecure", false, "Use this flag to disable verification of SSL/TLS certificates")
1821

1922
var Version = "dev"
2023
var CommitHash = "n/a"
2124
var BuildTimestamp = "n/a"
2225

2326
func main() {
2427
flag.Parse()
28+
log.Printf("inscure: %v", *enableInsecure)
2529

2630
if *printVersion {
2731
log.Printf("git-backup, version %s (%s-%s)", Version, runtime.GOOS, runtime.GOARCH)
2832
log.Printf("Built %s (%s)", CommitHash, BuildTimestamp)
2933
os.Exit(0)
3034
}
3135

36+
if *enableInsecure {
37+
http.DefaultTransport.(*http.Transport).TLSClientConfig = &tls.Config{InsecureSkipVerify: true}
38+
}
39+
3240
config := loadConfig()
3341
sources := config.GetSources()
3442
if len(sources) == 0 {

0 commit comments

Comments
 (0)