ProjectScaffold icon indicating copy to clipboard operation
ProjectScaffold copied to clipboard

Permission denied (publickey).

Open aureole82 opened this issue 9 years ago • 6 comments

After months I've just tried to get ProjectScaffold running again. I'm stuck in the release process:

My Release target doesn't work. Works: Git.Commit.Commit "" (sprintf "Version %s" release.NugetVersion) Works not: Branches.push ""

C:\Program Files (x86)\Git\bin\git.exe commit -m "Version 1.0.2"
[master af57ed8] Version 1.0.2
 2 files changed, 6 insertions(+), 3 deletions(-)
[master af57ed8] Version 1.0.2
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

Even worse now: Branches.pushTag "" "origin" release.NugetVersion works and marks my old commit with the new commit

C:\Program Files (x86)\Git\bin\git.exe tag 1.0.2
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Created draft release id 1250745
Released 1250745 on github
Finished Target: Release

The result is a correct local 1.0.2 version and a wrong remote 1.0.2 version. And pushing manually is impossible due to the tag confilcts!

By the way: My private key is placed where it's explected: C:\Users\aureole82.ssh\

aureole82 avatar May 03 '15 20:05 aureole82

strange. no idea what's going on, but try to remove the tag manually from the remote and local repo.

The check if you can push from the cmd. And retry

forki avatar May 04 '15 07:05 forki

Removing both tags and pushing manually can't be the final solution. What about stopping the whole release process if pushing fails?

Regarding the Permission denied (publickey) issue: It works on my manchine at the office. So I need to investigate the differences :-( Do you know if I need the Git directory in my PATH variables?

aureole82 avatar May 04 '15 08:05 aureole82

It may be a good idea to reorder the target such that we first create both commit and tag locally and then, in the end, push to the remote repo (and populate the github release).

However, I don't quite understand yet how the remote tag can possibly point to a different commit after pushing than the local tag. In order to understand what has happened, in the broken repo clone, can you print out the output of the following commands?

git rev-parse 1.0.2
git ls-remote origin 1.0.2
git ls-remote origin 1.0.2^{}

PS: any particular reason we don't use annotated tags?

cdrnet avatar May 04 '15 10:05 cdrnet

As I said

Works not: Branches.push ""

so the origin/master don't know about the last commit and as far as I understand the following marks the latest remote commit as a release:

    createClient (getBuildParamOrDefault "github-user" "") (getBuildParamOrDefault "github-pw" "")
    |> createDraft gitOwner gitName release.NugetVersion (release.SemVer.PreRelease <> None) release.Notes 
    |> releaseDraft
    |> Async.RunSynchronously

Here is the output you requested:

C:\Users\aureole82\My Projects\Camp.Fake.ProjectScaffold>git rev-parse 1.0.6
176f14e7992d38635532b23f5719ac2be038ad0a

C:\Users\aureole82\My Projects\Camp.Fake.ProjectScaffold>git ls-remote origin 1.0.6
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

C:\Users\aureole82\My Projects\Camp.Fake.ProjectScaffold>git ls-remote origin 1.0.6^{}
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

Sorry, my local git is misconfigured. I'll try to fix...

aureole82 avatar May 04 '15 19:05 aureole82

Ok, after a lot of pointless stackoverflow posts I quit and took the ssh-agent-utils.ps1 script we're using at work. After running it my ssh-agent is up and configured like you need it to push sucessfully.

Is there another way to check the ssh-agent and run if necessary?

And just for newbies like me: Call >Set-ExecutionPolicy Unrestricted on a powershell with administrator privileges. Otherwise you'll never get this script running.

aureole82 avatar May 04 '15 20:05 aureole82

Ah yes - the problem is that in Octokit we do not provide the target_commitish argument when we create the release, so in case the tag does not exist yet it falls back to master. If we'd explicitly set the commit hash there (i.e. the output of git rev-parse 1.0.6) then creating the release should error as expected.

https://github.com/fsharp/FAKE/blob/master/modules/Octokit/Octokit.fsx#L31 https://github.com/octokit/octokit.net/blob/master/Octokit/Models/Request/NewRelease.cs#L17 https://developer.github.com/v3/repos/releases/#create-a-release

cdrnet avatar May 05 '15 04:05 cdrnet