+1
_examples/README.md
+1
_examples/README.md
···
12
12
a repository using a GitHub personal access token.
13
13
- [ssh private key](clone/auth/ssh/private_key/main.go) - Cloning a repository using a ssh private key.
14
14
- [ssh agent](clone/auth/ssh/ssh_agent/main.go) - Cloning a repository using ssh-agent.
15
+
- [config](config/main.go) - Explains how to work with config files.
15
16
- [commit](commit/main.go) - Commit changes to the current branch to an existent repository.
16
17
- [push](push/main.go) - Push repository to default remote (origin).
17
18
- [pull](pull/main.go) - Pull changes from a remote repository.
+1
_examples/common_test.go
+1
_examples/common_test.go
···
19
19
"checkout": {defaultURL, tempFolder(), "35e85108805c84807bc66a02d91535e1e24b38b9"},
20
20
"checkout-branch": {defaultURL, tempFolder(), "branch"},
21
21
"clone": {defaultURL, tempFolder()},
22
+
"config": {},
22
23
"commit": {cloneRepository(defaultURL, tempFolder())},
23
24
"context": {defaultURL, tempFolder()},
24
25
"custom_http": {defaultURL},
+7
-1
_examples/config/main.go
+7
-1
_examples/config/main.go
···
1
1
package main
2
2
3
3
import (
4
+
"os"
5
+
4
6
"github.com/go-git/go-git/v5"
5
7
. "github.com/go-git/go-git/v5/_examples"
6
8
···
12
14
// - Set basic local config params
13
15
14
16
func main() {
17
+
tmp, err := os.MkdirTemp("", "go-git-example")
18
+
CheckIfError(err)
19
+
defer os.RemoveAll(tmp)
20
+
15
21
Info("git init")
16
-
r, err := git.PlainInit(".", false)
22
+
r, err := git.PlainInit(tmp, false)
17
23
CheckIfError(err)
18
24
19
25
// Load the configuration