Kitchi
Kitchi

Reputation: 1904

Git and Bitbucket without SSH

I've set up a local git repository on my computer, and I'm trying to push that to a newly created Bitbucket account.

The problem is that Bitbucket gives me an ssh url to push to, but the network I'm on (university) has the ssh port blocked for external ssh. So that fails, and if I try to replace ssh:// with https:// it keeps telling me that authentication has failed.

Is there a way to push to bitbucket without using ssh?

Upvotes: 28

Views: 25257

Answers (4)

Michael come lately
Michael come lately

Reputation: 9333

If they've blocked the port, but not the protocol, you can use SSH over the HTTPS port on several major code hosts.

You could probably accomplish this with carefully crafted remotes in your repository configuration, but it's much easier to ask SSH to remap those connections for your whole user account. This goes in ~/.ssh/config:

Host bitbucket.org
    HostName altssh.bitbucket.org
    Port 443

Host github.com
    HostName ssh.github.com
    Port 443

Host gitlab.com
    HostName altssh.gitlab.com
    Port 443

Also, for kicks, you can add RequestTTY no and User git to each block to make it easy to ssh -v github.com to debug connections. (Bonus: adding hosts to SSH config makes them tab-complete.)

Upvotes: 0

Largo
Largo

Reputation: 330

I wanted to add that SourceTree somehow wants it without the username:

https://bitbucket.org/username/repository.git

Upvotes: 3

poke
poke

Reputation: 387587

You can connect to GitHub and Bitbucket repositories via HTTPS. Both will also let you push.

These are the typical URLs for HTTPS access:

https://[email protected]/username/repository.git
https://github.com/username/repository.git

Note that Git will prompt you for your password whenever you want to communicate with the remote.

Upvotes: 55

gpicchiarelli
gpicchiarelli

Reputation: 452

Have you tried using?

[email protected]:accountname/reponame.git

You may take a look here

Upvotes: -2

Related Questions