コード例 #1
0
    public static void PushLocalToGitLab(string directoryPath, string userName, string newRepoName, out string gitCreatedUrl)
    {
        QuickGit.CreateGitKeepInEmptyFolders(directoryPath);
        directoryPath = UnityPaths.ReplaceByBackslash(directoryPath);
        UnityEngine.Debug.Log("" + userName + "????" + newRepoName);
        UnityEngine.Debug.Log("" + "????" + directoryPath);
        if (!string.IsNullOrEmpty(userName) && !string.IsNullOrEmpty(newRepoName))
        {
            gitCreatedUrl = "https://gitlab.com/" + userName + "/" + newRepoName + ".git";
        }
        else
        {
            gitCreatedUrl = "";
        }

        //https://docs.gitlab.com/ee/gitlab-basics/create-project.html
        //git push --set-upstream https://gitlab.example.com/namespace/nonexistent-project.git master
        //git push --set-upstream address/your-project.git
        WindowCMD.RunCommands(new string[] {
            "git add .",
            "git commit -m \"Local to Remote\"",
            "git push --set-upstream \"https://gitlab.com/" + userName + "/" + newRepoName + ".git\" master",
            "git push -u origin master"
        }, directoryPath);
    }