diff --git a/pagure/api/project.py b/pagure/api/project.py index 904673d..2d0798b 100644 --- a/pagure/api/project.py +++ b/pagure/api/project.py @@ -184,9 +184,17 @@ def api_project_git_urls(repo, username=None, namespace=None): if repo is None: raise pagure.exceptions.APIError(404, error_code=APIERROR.ENOPROJECT) git_urls = {} - if pagure.APP.config.get('GIT_URL_SSH'): - git_urls['ssh'] = '{0}{1}.git'.format( - pagure.APP.config['GIT_URL_SSH'], repo.fullname) + + git_url_ssh = APP.config.get('GIT_URL_SSH') + if authenticated() and git_url_ssh: + try: + git_url_ssh = git_url_ssh.format( + username=flask.g.fas_user.username) + except (KeyError, IndexError): + pass + + if git_url_ssh: + git_urls['ssh'] = '{0}{1}.git'.format(git_url_ssh, repo.fullname) if pagure.APP.config.get('GIT_URL_GIT'): git_urls['git'] = '{0}{1}.git'.format( pagure.APP.config['GIT_URL_GIT'], repo.fullname) diff --git a/pagure/templates/repo_info.html b/pagure/templates/repo_info.html index e2c33d3..c81a3ed 100644 --- a/pagure/templates/repo_info.html +++ b/pagure/templates/repo_info.html @@ -158,6 +158,7 @@ git push -u origin master aria-expanded="false" aria-controls="moregiturls" id="more_gits">more{%endif%}