Reputation: 58632
I want to script update my remote.origin.url from https to git
I came up with this
IN=$(git config --get remote.origin.url)
arrIN=(${IN//@/ })
echo "git@"${arrIN[1]} | bash -s git remote set-url origin
My echo line seems to display correct
[email protected]:bh/app.git
What did I do wrong ?
Upvotes: 1
Views: 69
Reputation: 361555
-s
tells bash to read commands from stdin. Not arguments to commands you've given on the command-line, but full commands. It ignores any command on the command-line.
$ echo 'echo test command' | bash -s 'echo this command is ignored'
test command
You don't need bash -s
. You can just append the string you want to the git remote set-url
command.
git remote set-url origin git@"${arrIN[1]}"
Upvotes: 1