pushing new repos needs ssh keys.

Issue #4 resolved
clach04 NA created an issue

I get permission denied errors when the script pushes the new repo:

‌ remote: Permission denied (publickey).
ERROR: Repository error

This stops the script from working.

Looks like this is due to preferring ssh urls. Hacking the script to prefer https works BUT it then prompts for passwords which is then a usability issue. Ideal solution there is hacking findCloneUrl() to inject password into the URL. Not sure what the best way to force https is, for now I have this:

#def findCloneUrl(cls, repo, preferred='ssh'):
def findCloneUrl(cls, repo, preferred='https'):

Comments (8)

  1. clach04 NA reporter

    Here is the diff I’m currently using, not sure about how to indicate using https over SSH. I’m guessing ssh is preferred for a reason? As the instructions/FAQ recommend using an application password I would have guessed https would be preffered.

    diff bbhg2git.py  FULL_WORKING_bbhg2git.py
    156c156
    <       def __init__(self, workdir, repository):
    ---
    >       def __init__(self, workdir, repository, username, password):
    158a159,160
    >               self.username = username
    >               self.password = password
    167c169,172
    <               gitUrl = self.findCloneUrl(gitRepo)
    ---
    >               gitUrl = self.findCloneUrl(gitRepo)
    >               # if using https inject app password into URL
    >               if gitUrl.startswith('https'):
    >                       gitUrl = gitUrl.replace('%s@bitbucket' % self.username, '%s:%s@bitbucket' % (self.username, self.password))
    219c224,225
    <       def findCloneUrl(cls, repo, preferred='ssh'):
    ---
    >       #def findCloneUrl(cls, repo, preferred='ssh'):
    >       def findCloneUrl(cls, repo, preferred='https'):
    320c326
    <       helper = RepositoryMigrationHelper(workdir, repo)
    ---
    >       helper = RepositoryMigrationHelper(workdir, repo, args.user, args.password)
    337a344
    >       break  # DEBUG clach04 stop after first one
    

  2. Ed Randall repo owner

    I’ve always preferred ssh over https where possible, it’s usually the first thing I configure on my account. Don’t most people do the same? I’ll add a note that the user needs to set up an ssh key and maybe we can have a --https option for those who need it.

    • the application password is a slightly different issue (to authenticate for the Bitbucket REST api)
  3. clach04 NA reporter

    @Ed Randall +1 for the https option. That would be my preferred root.

    I would implement this myself but I’m wrapping up for the day and not sure when I’ll get back to this. Thanks again for sharing what you have worked on, nicely done! :-)

  4. Log in to comment