GitSharp.Core.Repository.Create C# (CSharp) Method

Create() public method

Create a new Git repository initializing the necessary files and directories.
public Create ( ) : void
return void
        public void Create()
        {
            Create(false);
        }

Same methods

Repository::Create ( bool bare ) : void

Usage Example

Example #1
0
        public override void Execute()
        {
            if (Source.Length <= 0)
            {
                throw new ArgumentNullException("Repository", "fatal: You must specify a repository to clone.");
            }

            URIish source = new URIish(Source);

            if (Mirror)
            {
                Bare = true;
            }
            if (Bare)
            {
                if (OriginName != null)
                {
                    throw new ArgumentException("Bare+Origin", "--bare and --origin " + OriginName + " options are incompatible.");
                }
                NoCheckout = true;
            }
            if (OriginName == null)
            {
                OriginName = "origin";
            }

            var repo = new GitSharp.Core.Repository(new DirectoryInfo(ActualDirectory));

            repo.Create(Bare);
            repo.Config.setBoolean("core", null, "bare", Bare);
            repo.Config.save();
            Repository = new Repository(repo);
            if (!Quiet)
            {
                OutputStream.WriteLine("Initialized empty Git repository in " + repo.Directory.FullName);
                OutputStream.Flush();
            }

            saveRemote(source);
            FetchResult r = runFetch();

            GitSharp.Core.Ref branch = guessHEAD(r);
            if (!NoCheckout)
            {
                doCheckout(branch);
            }
        }
All Usage Examples Of GitSharp.Core.Repository::Create