cake-contrib / Cake_Git

Cake AddIn that extends Cake with Git features using LibGit2 and LibGit2Sharp
https://cakebuild.net/extensions/cake-git
Other
39 stars 64 forks source link

Examples #93

Closed FynZ closed 4 years ago

FynZ commented 5 years ago

Hi,

Would be great to have examples with the package documentation. Can't have the GitPushRefs call to work and I have to fallback to a Cmd call to achieve what I want.

Thanks :).

devlead commented 5 years ago

Alias is documented at https://cakebuild.net/api/Cake.Git/GitAliases/D653967D and https://cakebuild.net/api/Cake.Git/GitAliases/FB8D8875

Looks like something might be missing from nuget package as examples are in code but not on cakebuild.net

https://github.com/cake-contrib/Cake_Git/blob/cb66a1f5382a578e39a9db4e303daa1268c87df9/src/Cake.Git/GitAliases.Push.cs#L189-L193

https://github.com/cake-contrib/Cake_Git/blob/cb66a1f5382a578e39a9db4e303daa1268c87df9/src/Cake.Git/GitAliases.Push.cs#L246-L250

Looking at pr #11 which added this there's an example

GitTag("./", "v1.0.0");
GitPushRef("./", gitUsername, gitPassword, "origin", "v1.0.0");
FynZ commented 5 years ago

Hi, tank for the help and sorry for the delay.

It was indeed a configuration problem as I was passing "master" as the fourth argument instead of "origin" (bad checking on my part) but now stuck with another issue which is LibGit2Sharp.LibGit2SharpException: unsupported URL protocol. The password I am using contains html characters but the same error occurs if I pass the raw password or the encoded one.

Thanks.

Here is a simple code of what i'm doing in my cake script

string usr = "my_super_user";
string pwd = "my_super_password";

DirectoryPath repositoryPath = MakeAbsolute(Directory("../"));            
string tag = $"TEST-TAG";

Information("Tagging current commit with value {0}", tag);
GitTag(repositoryPath, tag, commit);

Information("Push tag {0} to remote repository", tag);
GitPushRef(repositoryPath, usr, pwd, "origin" , tag);