1

In our development environment, outgoing Port 22 are blocked. And I assume the git push .. command sends the files via SSH/22.

We're using BitBucket. Is it possible to git push using HTTPS protocol instead of via SSH?

1 Answer 1

2

When you run git push, it uses the URL for the remote you're pushing to to figure out how to transmit changes. It doesn't necessarily use SSH, or port 22; that only happens if the URL tells it to use SSH and port 22. See Git URLs in the manual for more information.

In particular, if the remote URL is an HTTPS URL, then Git will use HTTPS when pushing.

4
  • Oh, so the protocol used in git push depends on what was used in git remote origin earlier? That means, if the repo was cloned by using https, then the pushing will be going through https? Commented Sep 17, 2020 at 5:23
  • That is the default, yes. You can configure it to what you need or want Commented Sep 17, 2020 at 5:36
  • Yes it works. I didn't know the push command follows the same Protocol used in the cloning process earlier. Thanks. Commented Sep 17, 2020 at 5:39
  • If someone tries to push using https in 2022 it no longer works: remote: Support for password authentication was removed on August 13, 2021. This is the message I got when trying to push using https, ssh is mandatory Commented Oct 23, 2022 at 18:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .