bitbucket can't pull/push from repository

前端 未结 20 1782
鱼传尺愫
鱼传尺愫 2021-02-06 23:04

So basically I have a server where I have bitbucket git repository set up. I\'ve been using it for months and now out of the blue sky when I try to pull I get the following erro

相关标签:
20条回答
  • 2021-02-06 23:32

    Alright, as I am getting the hang of git, I would like to attempt to provide feedback/cherry pick on the easy stuff. The error "can't pull/push from repository" typically happens if the user you are using does not have rights to push to the desired remote git repository. If you are new, this should be your origin.

    Check SSH Agent:

    • Check Private Key: navigate to your present user's home directory, on linux this is ~/. In this directory check for the folder ~/.ssh. If it exists, you possibly have git setup correctly. Else, if the folder does not exist, find a useful tutorial online to help you setup git on your machine from start to finish.
    • Check Public Key: if you actually found a .ssh folder in your home directory, then look at the public and private keys. Log into your git account online, and navigate to your public key, compare that to the file ~/.ssh/id_rsa.pub. If the contents are the same, your machine should be communicating with the remote server without any issues.

    Check Remote: you are here because you are certain that git is installed on your machine, and that your present private key has had it's corresponding public key copied into your online git account. But you may be pushing to the wrong location. First check the branch that you are working on, were you pushing the right branch? Type;

    git branch

    You should see your branches listed with the present branch highlighted or with an asterisk in front of the name. If you wish to be pushing a different branch, check it out and continue. Then, confirm that you have the right url in origin, type;

    git remote -v

    Use the given output to confirm that you were pushing to the right remote. If not type;

    git remote remove <name>

    and follow that with

    git remote add <name> <url>

    this way when you push your code using

    git push <name> <branch>

    Everything should be pushed accordingly.

    If after checking the above steps, you find that you are still locked out. Note, I assumed that you have a working internet connection. I would obviously setup git from scratch - not the same as reinstalling it, just setup it up and make sure you note the user setting up, and the passphrase that you are using. You should be fine.


    Example URL: git@bitbucket.org:username/repository_name.git

    0 讨论(0)
  • 2021-02-06 23:35

    This issue is caused by incorrect git configuration. Open .git folder in root folder of your project and in config file please find the line that starts with

    url = git@bitbucket.org

    Most probably you have specified protocol there and defined url like url = ssh://git@bitbucket.org

    remove ssh:// and it should do the trick for you.

    0 讨论(0)
  • 2021-02-06 23:36

    I don't know the exact cause for this issue.First thing to is to ping bitbucket.org. If you are getting response then follow that steps below.

    Go to .git folder of you repo, use your favorite editor.open config file and change the url value as shown below.Worked for me.

    https://bitbucket.org/<username>/<repo>  -> https://<username>@bitbucket.org/<username>/<repo>
    

    Same steps will fix ssh issue also, Just add username.

    In the picture is my notes repo , where i save all my notes

    0 讨论(0)
  • 2021-02-06 23:36

    This seems a lot like the issue I'm facing. In my case the problem was related to IPv6 (for details see: Can't push/pull to bitbucket via SSH when behind VPN. IPv6 issue?). The workaround was to add AddressFamily inet to my .ssh/config file under the Host bitbucket entry, which forces that connection to use IPv4.

    0 讨论(0)
  • 2021-02-06 23:36

    Just in case none of those answers helped, in my case I was using a "ghost" terminal session. The output of "whoami" was showing some unknown user, and the solution was to close and open a new console window.

    0 讨论(0)
  • 2021-02-06 23:37

    This basically means that you are unable to establish a connection with the bibucket because your network isnt allowing you to do so. Try installing the certificates and then use the "git clone" command to clone your repo. c:-->program files -->git -->usr -->ssl -->cer and install the certificates by clicking on ca-bundle and ca-bundle.trust Worked for me . Let me know how it helps you :-)

    0 讨论(0)
提交回复
热议问题