Search code examples
gitsshgitkrakenssh-agent

why can't push in a second cloned repository?


i have a repository on bitbucket and i cloned it to my laptop as "Repo1" and there it is where i commit and push. From an instance of DigitalOcean i make pull requests. But, i cloned again the repository from bitbucket to my laptop as "Repo2" and i dit lot of changes and continue working normally.

Now i need to push a commit and GitKraken says "error authenticating. failed connecting with agent"

If i push the commit with the shell "git push origin master" appears "Unauthorized. fatal: can't read remote repository"

How can i do to push from the second repository?

I have already set user.name and user.email and remote addedd

Please help :-(


Solution

  • You have two ways to clone your repo, either by ssh or by https protocols. You are likely using ssh. (ie. you cloned your repo with

    git clone ssh://[email protected]:{username}/{repo_name}.git
    

    ).

    In the computer you are having the problem, the ssh private key is missing or the public one is not the same as the one registered in bitbucket.

    To move ahead with this problem, you can add the repo with https protocol (in your laptop where Repo2 is located) using

    git remote add origin https://{username}@bitbucket.org/{username}/{repo}.git
    

    and then do your push as usual. It should work :)