Skip to content

Commit 4e5aa34

Browse files
committed
Suggest a solution for users without ssh set up
Users who haven't set up ssh will get a Permission denied error from github when using `dune-release publish`. This commit adds to the README how the user can configure git in order to solve that problem. It also adds a hint to the Permission denied error message pointing to that new part of the README.
1 parent a78211d commit 4e5aa34

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

CHANGES.md

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
- Log curl calls on verbose/debug mode (#281, @gpetiot)
77
- Try to publish the release asset again after it failed (#272, @gpetiot)
88
- Improve error reporting of failing git comands (#257, @gpetiot)
9+
- Suggest a solution for users without ssh setup (#this, @pitag-ha)
910

1011
### Changed
1112

README.md

+9
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,15 @@ The full documentation of this command is available with
137137
dune-release help publish
138138
```
139139

140+
## Publish troubleshooting
141+
142+
If github returns a `Permission denied` error during `dune-release publish`, the reason is probably a failing ssh connection. In that case, we suggest that you set up ssh. If you prefer not to and you've already set up https instead, we suggest that you configure git as follows:
143+
```
144+
git config [--global] url."https://github.com/".pushInsteadOf "git@github.com:"
145+
```
146+
Running that line once will configure git to always push over https - either for that repository or globally.
147+
148+
In more detail: `dune-release publish` always pushes to github over ssh by explicitly giving git the github uri of your project with ssh prefix (`git@github.com:`). By configuring git as suggested above, git will automatically replace that prefix by the https one when pushing and push over https instead.
140149

141150
### Create an opam package and submit it to the opam repository
142151

lib/vcs.ml

+10
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,16 @@ let run_git ~dry_run ?force ~default r args out =
6262
>>= fun response ->
6363
match response.status with
6464
| `Exited 0 -> Ok response.output
65+
| `Exited 128
66+
when String.is_prefix response.err_msg
67+
~affix:"git@github.com: Permission denied" ->
68+
let hint =
69+
"\n\
70+
Hint from dune-release: the reason for the Permission denied error is \
71+
probably a failing ssh connection. For more information, see \
72+
https://github.com/ocamllabs/dune-release#publish-troubleshooting ."
73+
in
74+
Sos.cmd_error git (Some (response.err_msg ^ hint)) response.status
6575
| _ -> Sos.cmd_error git (Some response.err_msg) response.status
6676

6777
let run_git_quiet ~dry_run ?force r args =

0 commit comments

Comments
 (0)