Assuming you've successfully built libgit2...
$ ls -l
drwxr-xr-x ... libgit2
-rw-r--r-- ... test.c
$
$ gcc -I ./libgit2/include -L ./libgit2/build -l git2 -o test test.c
Assuming you've successfully built libgit2...
$ ls -l
drwxr-xr-x ... libgit2
-rw-r--r-- ... test.c
$
$ gcc -I ./libgit2/include -L ./libgit2/build -l git2 -o test test.c