mirror of
https://github.com/kiegroup/git-backporting.git
synced 2025-05-10 18:53:43 +00:00
fix: --auth when --git-user contains space (#95)
Since --git-user is a user-facing name, it's common to include a space in it. As such, it's not suitable to use as a username in a Git remote URL. GitLab documented that it doesn't (yet?) check for username [1], and from my testing GitHub doesn't seem to care either. So just use an arbitrary name as a username. [1] https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html
This commit is contained in:
parent
d4dc510af1
commit
9bcd6e6b55
4 changed files with 27 additions and 6 deletions
5
dist/cli/index.js
vendored
5
dist/cli/index.js
vendored
|
@ -493,8 +493,9 @@ class GitCLIService {
|
|||
* @param remoteURL remote link, e.g., https://github.com/kiegroup/git-backporting-example.git
|
||||
*/
|
||||
remoteWithAuth(remoteURL) {
|
||||
if (this.auth && this.gitData.user) {
|
||||
return remoteURL.replace("://", `://${this.gitData.user}:${this.auth}@`);
|
||||
if (this.auth) {
|
||||
// Anything will work as a username.
|
||||
return remoteURL.replace("://", `://token:${this.auth}@`);
|
||||
}
|
||||
// return remote as it is
|
||||
return remoteURL;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue