Skip to content
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
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy