Git error: “Please make sure you have the correct access rights and the repository exists”

后端 未结 27 914
面向向阳花
面向向阳花 2020-12-12 14:49

I am using TortoiseGit on Windows. When I am trying to Clone from the context menu of the standard Windows Explorer, I get this error:

Please make sur

相关标签:
27条回答
  • 2020-12-12 15:02

    add these lines to your .get/config file (thanks to @kovshenin answer Git Pull: Change Authentication) :

    [credential]
        helper = wincred
    
    0 讨论(0)
  • 2020-12-12 15:03

    Here is how I solve this issue. I was using Babun(mintty.exe) on Win7/10. When I have tried many solutions mentioned above, and none of them works. I realized maybe I just used wrong ssh agent... So I run echo $GIT_SSH to find out, it shows the path to Plink.exe. What I actually expected is OpenSSH.

    So, I add following one-liner to ~/.zshrc file

    Note 1: You can execute it in babun directly also
    Note 2: You if you use bash then the config file is .bashrc

    export GIT_SSH=$(which ssh)
    

    And It works!

    0 讨论(0)
  • 2020-12-12 15:05

    The rsa.pub (i.e. public key generated), needs to be added on the github>> settings>>ssh keys page. Check that, you have not added this public key in the repository-settings >> deployment keys. If so, remove the entry from here and add to the first place mentioned.

    Setup of the pub-private keys in detail.

    It will work hence!

    0 讨论(0)
  • 2020-12-12 15:05

    I come across this error while uploading project to gitlab. I didn't clone from git but instead upload project. For pushing your code to gitlab you have two ways either using ssh or https. If you use https you have to enter username and password of gitlab account. For pushing you code to git you can use following one.

    Pushing to Git for the first time

    >$ cd
    >$ mkdir .ssh;cd .ssh
    >$ ssh-keygen -o -t rsa -b 4096 -C "email@example.com"
    

    The -C parameter is optional, it provides a comment at the end of your key to distinguish it from others if you have multiple. This will create id_rsa (your private key) and id_rsa.pub (your public key). We pass our public key around and keep our private key — well, private. Gitlab’s User Settings is where you would then add your public key to your account, allowing us to finally push.

    In your project location(Directory) use below command

    git init
    

    It Transform the current directory into a Git repository. This adds a .git subdirectory to the current directory and makes it possible to start recording revisions of the project.

    Push Using https path

    git push --set-upstream https://gitlab.com/Account_User_Name/Your_Project_Name.git master
    

    Push Using ssh path

    git push --set-upstream git@gitlab.com:Account_User_Name/Your_project_Name.git master
    

    — set-upstream: tells git the path to origin. If Git has previously pushed on your current branch, it will remember where origin is

    master: this is the name of the branch I want to push to when initializing

    0 讨论(0)
  • 2020-12-12 15:05

    Like other answers, use https instead of ssh was the solution.

    I post an answer to give a concrete example of a possible solution. I solved this issue with bitbucket when I changed remote url to HTTPS with this command line:

    git remote set-url origin <bitbucket_URL>
    

    After that, I could push the content to the repository with this command:

    git push -u origin --all
    

    And then I could also use Sourcetree

    0 讨论(0)
  • 2020-12-12 15:06

    Adding ssh key worked for me. You can create ssh key with ssh-keygen command on mac. You should be able to see Deploy keys menu on YourRepository>Settings don't forget to check Allow write access option.

    deploy keys menu screenshot

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