-
Notifications
You must be signed in to change notification settings - Fork 482
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add option to specify username when deploying via ssh #1285
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea!
src/Documenter.jl
Outdated
@@ -474,7 +474,7 @@ The documentation are placed in the folder specified by `subfolder`. | |||
function git_push( | |||
root, temp, repo; | |||
branch="gh-pages", dirname="", target="site", sha="", devurl="dev", | |||
versions, forcepush=false, deploy_config, subfolder, | |||
versions, forcepush=false, deploy_config, subfolder, username="git" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
username
is not used anywhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that was left over from an earlier attempt, thanks for catching it
src/Documenter.jl
Outdated
host = match(r"(.*?)[:\/]", repo)[1] | ||
# The upstream URL to which we push new content and the ssh decryption commands. | ||
upstream = "git@$(replace(repo, "$host/" => "$host:"))" | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a suggestion: it feels like it should be possible to do this with just a single regex, e.g.:
match(r"(?:([^@]*)@)?(.*?)[:\/]", "user@foo.com/blah.git")
And if the first capture group is nothing
, then use the default username.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, could we refactor this into a function (returning a user, upstream
tuple?) and add some unit tests, just to make sure that the code does exactly what it is supposed to?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that is much more elegant (my feeble regex skills failed me). Where would be a good place to put the unit tests?
I've factored out the repo-disassembly into Regarding the new function |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Just added a two more test cases.
We can add it here: https://github.com/JuliaDocs/Documenter.jl/blob/master/docs/src/lib/internals/documenter.md |
Co-Authored-By: Morten Piibeleht <morten.piibeleht@gmail.com>
Co-Authored-By: Morten Piibeleht <morten.piibeleht@gmail.com>
…Documenter.jl into deploy_ssh_username
Good to go as far as I can tell. Thanks for the contribution @chrisbrahms! |
This deals with the case of a username being specified in the the repository url in
deploydocs
. That is, if one callsdeploydocs
like this:deploying now works, rather than trying to push to
git@user@host:/path/to/repo
.This came up when hosting documentation on a webserver where the
git
user already exists but I can't get access to it.