hub icon indicating copy to clipboard operation
hub copied to clipboard

`remote add` should set usable pushurl

Open v4hn opened this issue 3 years ago • 1 comments

The problem I'm trying to solve:

$ cd my-github-repository
$ hub remote add <someusername>
$ git push <someusername>
fatal: remote error:
  You can't push to git://github.com/<someusername>/repo.git
  Use https://github.com/<someusername>/repo.git
$ tail -n3 .git/config
[remote "someusername"]
        url = git://github.com/<someusername>/repo.git
        fetch = +refs/heads/*:refs/remotes/someusername/*

How I imagine hub could expose this functionality:

hub could simply add the ssh pushurl entry as well. This is what I do by hand for quite a while every now and then:

$ tail -n4 .git/config
[remote "someusername"]
        url = git://github.com/<someusername>/repo.git
        url = [email protected]:<someusername>/repo.git
        fetch = +refs/heads/*:refs/remotes/someusername/*

v4hn avatar Jun 14 '21 08:06 v4hn