Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Change remote.origin.url from "https://..." to "git@...".
#!/usr/bin/env ruby
url = `git config remote.origin.url`
puts "BEFORE: #{url}"
if url.match(/https:\/\/([^\/@]+@)?([^\/]+)\/([^\/]+)\/(.+)\.git/)
optional_login_name, domain, name, repo = $1, $2, $3, $4
cmd = "git remote set-url origin git@#{domain}:#{name}/#{repo}.git"
puts cmd
url = `git config remote.origin.url`
puts "AFTER: #{url}"
puts "Unexpected remote.origin.url."
# vim: set filetype=ruby:

This comment has been minimized.

Copy link
Owner Author

commented Nov 30, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.