title: Create Initial Push into Newly Created Repository using VSTS Git API
body: <p>How to create initial push into newly created Repository using VSTS Git API?</p>
  
  <p>I have created a new repository.</p>
  
  <pre><code>using Microsoft.TeamFoundation.SourceControl.WebApi;
  using Microsoft.VisualStudio.Services.WebApi;
  using Microsoft.TeamFoundation.Core.WebApi
  
  var accountUri = new Uri("https://mysite.visualstudio.com");  
  var personalAccessToken = "myaccesstoken"; 
  var connection = new VssConnection(accountUri, new VssBasicCredential(string.Empty, personalAccessToken));
  
  // Get a GitHttpClient to talk to the Git endpoints
  var gitClient = connection.GetClient&lt;GitHttpClient&gt;();
  
  var teamProject = projectClient.GetProject("MyProject", true, true).Result;
  
  var repo = gitClient.CreateRepositoryAsync(new GitRepository
  {
      DefaultBranch = "refs/heads/master",
      Name = "TestRepo",
      ProjectReference = new TeamProjectReference
      {
          Id = teamProject.Id
      }
  }).Result;
  </code></pre>
  
  <p>The repo is successfully created. But why is the <code>repo.DefaultBranch</code> value is null?</p>
  
  <p>Next step, I'd like to push my initial commit.</p>
  
  <pre><code>var newBranch = new GitRefUpdate
  {
      RepositoryId = repo.Id,
      Name = $"refs/heads/master"
  };
  
  string newFileName = "README.md";
  GitCommitRef newCommit = new GitCommitRef
  {
      Comment = "Initial commit",
      Changes = new GitChange[]
      {
          new GitChange
          {
              ChangeType = VersionControlChangeType.Add,
              Item = new GitItem { Path = $"/master/{newFileName}" },
              NewContent = new ItemContent
              {
                  Content = "# Thank you for using VSTS!",
                  ContentType = ItemContentType.RawText,
              },
          }
      }
  };
  
  GitPush push = gitClient.CreatePushAsync(new GitPush
  {
      RefUpdates = new GitRefUpdate[] { newBranch },
      Commits = new GitCommitRef[] { newCommit },
  }, repo.Id).Result;
  </code></pre>
  
  <p>I got an error when calling <code>CreatePushAsync</code>:</p>
  
  <blockquote>
    <p>VssServiceException: The combination of parameters is either not valid
    or not complete. Parameter name: baseCommitId</p>
  </blockquote>
  
  <p>Please help how to create initial commit properly.</p>