Git and Bitbucket without SSH

2019-03-09 18:08发布

问题:

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?

回答1:

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://username@bitbucket.org/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.



回答2:

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

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


回答3:

Https addresses on GitHub are read-only. As far as I know, SSH is your only option if you need write access. See poke's answer.

Btw your slashes are wrong, it's ssh:// and https://



回答4:

Have you tried using?

git@bitbucket.org:accountname/reponame.git

You may take a look here



标签: git bitbucket