MCPcopy Create free account
hub / github.com/go-git/go-git / ExamplePlainClone_usernamePassword

Function ExamplePlainClone_usernamePassword

example_test.go:72–93  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

70}
71
72func ExamplePlainClone_usernamePassword() {
73 // Tempdir to clone the repository
74 dir, err := os.MkdirTemp("", "clone-example")
75 if err != nil {
76 log.Fatal(err)
77 }
78
79 defer os.RemoveAll(dir) // clean up
80
81 // Clones the repository into the given dir, just as a normal git clone does
82 _, err = git.PlainClone(dir, false, &git.CloneOptions{
83 URL: "https://github.com/git-fixtures/basic.git",
84 Auth: &http.BasicAuth{
85 Username: "username",
86 Password: "password",
87 },
88 })
89
90 if err != nil {
91 log.Fatal(err)
92 }
93}
94
95func ExamplePlainClone_accessToken() {
96 // Tempdir to clone the repository

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected