stack
stack

Reputation: 10228

Reporting problems to access bitbucket

When I execute this command:

$  git remote -v

result:

origin  https://[email protected]/ShafizadehSajad/test.git (fetch)
origin  https://[email protected]/ShafizadehSajad/test.git (push)

When I execute this command:

$ git push -u origin --all 
/* or even this one:
 * $ git push -4 origin master
 */

result:

// it waits for a while an throws this:
fatal: unable to access 'https://[email protected]/ShafizadehSajad/test.git/': Failed to connect to bitbucket.org port 443: Timed out

When I execute this command:

$ ping -n 10 bitbucket.org

result:

Pinging bitbucket.org [104.192.143.2] with 32 bytes of data:
Request timed out.
Request timed out.
Request timed out.
Request timed out.
Request timed out.
Request timed out.
Request timed out.
Request timed out.
Request timed out.
Request timed out.

Ping statistics for 104.192.143.2:
    Packets: Sent = 10, Received = 0, Lost = 10 (100% loss),

Well as you see, I cannot connect to bitbucket and apply changes. What's the problem? And how can I fix it?

Notes:

  1. I use windows 8 OS
  2. This current repo on bitbucket been a repo on github that I use it in bitbucket. When I was on github, it works as well.

EDIT:

And I've executed this command right now:

$ git config --local http.proxy http://proxyuser:[email protected]:8080

and now, when I execute this:

$ git push -u origin --all

result is:

fatal: unable to access 'https://[email protected]/ShafizadehSajad/test.git/': Couldn't resolve proxy 'proxy.server.com'

Heh .. it got worse. At least tell me how can I back it to the previous situation?

Upvotes: 0

Views: 1720

Answers (1)

VonC
VonC

Reputation: 1327394

General solution

There is no incident reported on BitBucket side or on twitter or on isitdownrightnow, so it is an issue on your side.

Switching to an ssh url would not help much since bitbucket.org is not reachable anyway.

Check if your firewall prevents somehow bitbucket.org access.

See more in my previous answer "Failed to connect to bitbucket.org port 443: Network is unreachable"

  • Check if your previous successful push to github.com needed a proxy.
  • Check if your DNS settings have changed (explaining why your proxy is not resolved)

Specific solution

After discussion, the OP stack can browse bitbucket.org only through a proxy (psiphon, see also this article or this one).
This proxy does not require authentication, but should be configured to run always on the same port in order for Git to use it. For instance, port 61234 (provided the port is not already used)

Making sure this proxy is used only for bitbucket.org is simple since Git 1.8.5 (2013).
Type, from any folder you want:

git config --global http."https://<username>@bitbucket.org".proxy http://localhost:61234

In your case:

git config --global http."https://[email protected]".proxy http://localhost:61234

That will modify your global Git setting (recorded in C:\Users\<You>\.gitconfig), and will apply those settings for any local repo you will create or already have.

To test an access to a remote Git repo without even having to clone it, use git ls-remote:

cd /path/to/local/repo
git remote -v
  origin https://[email protected]
git ls-remote origin

Since March 2015 and Git 2.7.3, Git for Windows comes with a Git Credential Manager for Windows which allows Git to cache passwords using the native Windows Credential Store: if you type git config credential.helper, you should see "manager".
At the first connection to bitbucket.org (like during a git ls-remote, done for testing access), you will be prompted for your bitbucket credentials (ie, ShafizadehSajad + bitbucket password). The next connections will reuse those credentials.
Open your credentials store with Control Panel, go to User Accounts and Family Safety -> Credential Manager: you will see a bitbucket.org entry.

Once a git ls-remote is working (and don't ask for your password, since it has been cached in the Windows Credential Store), a git push might fail because the remote repo was never fetched into the local one.

For that, first make sure a git pull will always rebase. Type, from any folder (and only once, since it is a global config)

git config --global pull.rebase true
git config --global rebase.autoStash true

(Those global settings are valid since Git 2.6, Sept. 2015)

Then, to fetch your remote bitbucket repo:

cd /path/to/local/repo
git fetch
git branch -u origin/master master

You need to make sure the local master branch is tracking the remote tracking origin/master branch which was just fetched.
See more at "Why do I need to explicitly push a new branch?".

Finally, pull first, since some commits were done directly on BitBucket, while others were done locally on the PC:

Before rebase:
x--x--x (master)
o--o    (origin/master)

git status:
(2 behind, 3 ahead)

After pull (which does here a fetch+rebase)
o--o--x'--x'--x' (master)
   |
 (origin/master)

The rebase has replayed your local 'x' commits on top of the fetched remote commits 'o'.

Now you are ready to push:

git push

Everything should be visible on bitbucket.org.

o--o--x'--x'--x' (master, origin/master)

(and github.com should not be affected, meaning a git ls-remote https://github.com/sajadshafizadeh/test.git should still work)

Upvotes: 2

Related Questions