bitbucket can't pull/push from repository

前端 未结 20 1739
鱼传尺愫
鱼传尺愫 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

    and follow that with

    git remote add

    this way when you push your code using

    git push

    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

提交回复
热议问题