1

I want to configure a Nginx as a proxy server as following:

(1) Client PC <-----> (2)Nginx <------> (3)Bitbucket 

In that:

  • (3) Bitbucket: I have created a repository, I can work with it via either ssh or https.

    • ssh: git@bitbucket.org:myname/myproject.git
    • https: https://myname@bitbucket.org/myname/myproject.git
  • (1) Client PC: from client I do not want to use directly domain bitbucket.org, instead of, I want to use address of Nginx server to conceal bitbucket.org domain. So I used to use Nginx.

  • (2) Nginx: I already installed and configured, It works well for http web.

My problem is I do not know how to configure Nginx to work with git bitbucket.
Please help me some suggestion.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
tienthanhakay
  • 396
  • 1
  • 4
  • 17

1 Answers1

0

If you can, you should configure NGiNX to be able to act as a git repo server to which you can push to.
Then a post-receive hook can push in turn to BitBucket.

That way, you are pushing to your NGiNX server which acts as a gatekeeper between you and BitBucket.

See "How to serve GIT through HTTP via NGINX with user/password?" as a concrete example of NGiNX git repo server configuration.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • What are the advantages of this approach? You can set up plenty of "gates" directly in Bitbucket Server if you need to - pre-receive or post-receive hooks, ref restrictions (aka branch permissions), and plugins like Yet Another Commit Checker let you do some powerful stuff. But your suggestion seems, at worst, dangerously overcomplicated. – daveruinseverything Mar 29 '17 at 09:02
  • @daveruinseverything the OP does not want to use directly domain bitbucket.org though – VonC Mar 29 '17 at 09:10
  • I misread this as Bitbucket Server (self-hosted), rather than Bitbucket Cloud. My bad @VonC, your advice makes sense if I actually read the question properly :D – daveruinseverything Mar 29 '17 at 23:11