The example is clear:
$ cd $GOPATH/src/github.com/user/hello
$ git init
You do initialize the repo within your project 'hello'.
That way:
-
you can push it to your GitHub repo (that you need to create first on GitHub, empty):
git remote add origin https://<user>@github.com/<user>/hello
git push -u origin master
-
your go project is "go gettable"
go get github.com/<user>/hello
# that would clone and compile the project in `$GOPATH/src/github.com/<user>/hello`.
The .git
you see outside hello
(on the same page) is for another project:
src/
github.com/golang/example/
.git/ # Git repository metadata
hello/
hello.go # command source
Here, the project is 'example
' and include several packages, including the hello
one.