seems like a rather lengthy expression here, maybe move this to a separate (private) method in this class?  E.g. 

    def remote_https_url(url)
        url.gsub(':','/').gsub(/^git@/,'https://').gsub(/\.git$/,'') + '/commit/'  
    end

    # call with this (i think having self.url == nil is probably OK)
    self.url = remote_https_url(g.remote.url) if g.remote.url