报告访问bitbucket的问题

时间:2016-12-28 08:21:15

标签: git bitbucket

执行此命令时:

$  git remote -v

结果:

origin  https://ShafizadehSajad@bitbucket.org/ShafizadehSajad/test.git (fetch)
origin  https://ShafizadehSajad@bitbucket.org/ShafizadehSajad/test.git (push)

执行此命令时:

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

结果:

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

执行此命令时:

$ ping -n 10 bitbucket.org

结果:

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),

如您所见,我无法连接到bitbucket并应用更改。问题是什么?我该如何解决?

备注:

  1. 我使用的是Windows 8 OS
  2. 这个关于bitbucket的当前回购是github上的一个回购,我在bitbucket中使用它。当我在github上时,它也能正常工作。
  3. 编辑:

    我现在已经执行了这个命令:

    $ git config --local http.proxy http://proxyuser:proxypwd@proxy.server.com:8080
    

    现在,当我执行此操作时:

    $ git push -u origin --all
    

    结果是:

    fatal: unable to access 'https://ShafizadehSajad@bitbucket.org/ShafizadehSajad/test.git/': Couldn't resolve proxy 'proxy.server.com'
    
    嘿..它变得更糟。至少告诉我如何才能将它恢复到以前的状态?

1 个答案:

答案 0 :(得分:2)

一般解决方案

没有报告on BitBucket sideon twitterisitdownrightnow的事件,因此这是您的问题。

切换到ssh网址无济于事,因为无论如何都无法访问bitbucket.org。

检查您的firewall prevents somehow bitbucket.org access

在我之前的回答“Failed to connect to bitbucket.org port 443: Network is unreachable

中查看更多内容
  • 检查您之前成功推送到github.com是否需要代理。
  • 检查您的DNS设置是否已更改(解释您的代理未解决的原因)

具体解决方案

经过讨论,OP stack只能通过代理psiphon浏览bitbucket.org,另请参阅this articlethis one。) 此代理不需要身份验证,但应配置为始终在同一端口上运行,以便Git使用它。例如,端口61234(提供port is not already used

确保此代理仅用于bitbucket.org,因为Git 1.8.5 (2013)很简单 从您想要的任何文件夹中输入:

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

your case中:

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

这将修改您的全球 Git设置(记录在C:\Users\<You>\.gitconfig中),并将这些设置应用于您将创建或已经拥有的任何本地仓库。

要测试对远程Git仓库的访问权限,而不必克隆它,请使用git ls-remote

cd /path/to/local/repo
git remote -v
  origin https://ShafizadehSajad@bitbucket.org
git ls-remote origin

March 2015 and Git 2.7.3起,Git for Windows附带Git Credential Manager for Windows,允许Git使用原生 Windows凭据存储缓存密码:如果您键入git config credential.helper,你应该看到“manager” 在第一次连接bitbucket.org时(例如在git ls-remote期间完成测试访问),系统将提示您输入bitbucket凭据(即ShafizadehSajad + bitbucket密码)。下一个连接将重用这些凭据 使用Control Panel, go to User Accounts and Family Safety -> Credential Manager打开您的凭据存储:您将看到bitbucket.org条目。

一旦git ls-remote正在运行(并且不要求您输入密码,因为它已在Windows凭据存储中缓存),git push可能会失败,因为远程仓库从未被提取到当地人。

为此,首先要确保git pull始终会变基。从任何文件夹中键入(只有一次,因为它是全局配置)

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

(那些global settings are valid since Git 2.6, Sept. 2015

然后,获取远程bitbucket repo:

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

您需要确保本地master分支正在跟踪刚刚获取的远程跟踪origin/master分支。
请点击“Why do I need to explicitly push a new branch?”了解更多信息。

最后,先拉,因为有些提交是直接在BitBucket上完成的,而其他提交是在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)

rebase在提取的远程提交“x”之上重播了您的本地“o”提交。

现在你准备好了:

git push

所有内容都应该在bitbucket.org上显示。

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

(且github.com不应受到影响,这意味着git ls-remote https://github.com/sajadshafizadeh/test.git仍应有效)