Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
jairbubbles edited this page Jun 3, 2017 · 6 revisions

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\\"

Clone this wiki locally

Morty Proxy This is a proxified and sanitized view of the page, visit original site.