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

Function ExamplePlainClone_accessToken

example_test.go:95–116  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

93}
94
95func ExamplePlainClone_accessToken() {
96 // Tempdir to clone the repository
97 dir, err := os.MkdirTemp("", "clone-example")
98 if err != nil {
99 log.Fatal(err)
100 }
101
102 defer os.RemoveAll(dir) // clean up
103
104 // Clones the repository into the given dir, just as a normal git clone does
105 _, err = git.PlainClone(dir, false, &git.CloneOptions{
106 URL: "https://github.com/git-fixtures/basic.git",
107 Auth: &http.BasicAuth{
108 Username: "abc123", // anything except an empty string
109 Password: "github_access_token",
110 },
111 })
112
113 if err != nil {
114 log.Fatal(err)
115 }
116}
117
118func ExampleRepository_References() {
119 r, _ := git.Clone(memory.NewStorage(), nil, &git.CloneOptions{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected