git init - libgit2/libgit2sharp GitHub Wiki
git-init
Create a new repository from a rooted path
Standard ".git" repository
Git
$ git init /d/temp/rooted/path
Initialized empty Git repository in d:/temp/rooted/path/.git/
LibGit2Sharp
string rootedPath = Repository.Init(@"D:\temp\rooted\path");
Console.WriteLine(rootedPath); // "D:\temp\rooted\path\.git\\"
Bare repository
Git
$ git init --bare /d/temp/rooted/path
Initialized empty Git repository in d:/temp/rooted/path/
LibGit2Sharp
string rootedPath = Repository.Init(@"D:\temp\rooted\path", true);
Console.WriteLine(rootedPath); // "D:\temp\rooted\path\\"
Create a new repository from a relative path
The relative path will be combined with the current working directory into an absolute path. Current working directory for the following code samples is "D:\Temp\".
Standard ".git" repository
Git
$ git init relative/path
Initialized empty Git repository in d:/temp/relative/path/.git/
LibGit2Sharp
string rootedPath = Repository.Init(@"relative\path");
Console.WriteLine(rootedPath); // "D:\temp\relative\path\.git\\"
Bare repository
Git
$ git init --bare relative/path
Initialized empty Git repository in d:/temp/relative/path/
LibGit2Sharp
string rootedPath = Repository.Init(@"relative\path", true);
Console.WriteLine(rootedPath); // "D:\temp\relative\path\\"