A minimal CLI tool and library for downloading and unpacking git archives. Basically, the Go version of degit
.
Features:
- Automatically download the latest default branch (as opposed to assuming
main
ormaster
) - Specify branches, tags, or commit hashes
- Specify subdirectories
- Support private repositories
Providers:
- GitHub
- GitLab
- Bitbucket
go install github.com/AaronCQL/gitget/cmd/gitget
Downloads the latest default branch to the current working directory:
gitget https://github.com/owner/repo
The following are all equivalent:
gitget github:owner/repo
gitget [email protected]:owner/repo
gitget github.com/owner/repo
Specific branches, tags, and commit hashes can also be specified. Use the --help
flag for more info:
gitget --help
gitget
can be used programmatically in your Go code. Start by installing this package:
go get -u github.com/AaronCQL/gitget
Then, use the gitget.Clone
function:
package main
import (
"fmt"
"github.com/AaronCQL/gitget/pkg/gitget"
)
func main() {
res, err := gitget.Clone("github.com/owner/repo", gitget.Config{})
if err != nil {
panic(err)
}
fmt.Printf(
"Cloned %v/%v (%v) into %v\n",
res.RepoOwner, res.RepoName, res.RepoFragment, res.TargetDirRel,
)
}