Unable to clone repository from Git

10,872

Solution 1

There are 2 methods you can try using

  1. Try cloning by adding your git username on the clone URL

git clone https://[email protected]/username/repository.git

It will prompt you for your password.

Alternatively, you can use

git clone https://username:[email protected]/username/repository.git

Or by using user token in case of Github

git clone https://username:[email protected]/username/repository.git

  1. Adding an SSH key on GIT generated from your machine. Use the link shared below to generate one https://help.github.com/en/enterprise/2.17/user/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent

Solution 2

for clone repository, you can use this command in terminal

git clone https://github.your_project_url.com/project

and when it asks for username and password

user_name: type Github user_name

password: don't use Github password which you use at the time of login to Github, instead, you have to use a personal access token

to generate this personal access token open your GitHub account and go to "Settings/Developer settings/Personal access tokens"

thanks

Solution 3

Best approach would be to configure using SSH:

  1. Generate the SSH key with ssh-keygen -t rsa -b 4096 (see here)
  2. Copy the content of your public SSH key, it is the file id_rsa.pub by default.

    Location: ~/.ssh(or if you are a window user, it will use whatever $HOME is, i.e., $HOME/.ssh)

  3. Paste the content into your GitHub/BitBucket account on the SSH key section

Get the repo

Just clone it:

GitHub: git clone [email protected]:YOUR_USERNAME/REPO_NAME.git

BitBucket: git clone [email protected]:USERNAME/REPO_NAME.git

Share:
10,872
Praveen Kumar
Author by

Praveen Kumar

Anything for Java ;)

Updated on June 16, 2022

Comments

  • Praveen Kumar
    Praveen Kumar almost 2 years

    I am new to Git. I am trying to clone a repository. I am able to clone it using Git bash command. But when I try to clone it using STS or Source Tree I get an error saying authentication not supported. I tried the following still nothing worked.

    1. Created Personal Access Token with api and read_user access.
    2. Tried adding https.sslVerify false
    3. Generated RSA Key from windows-->preferences-->Network Connection-->SSH2-->KeyManagement and pasted the public key.

    Please guide me further.

    • nivritgupta
      nivritgupta almost 6 years
      Sometime Sourcetree gives so many authentication issue when trying to clone or even take a new pull , just delete the previous stored username and password on sourcetree or maybe this link help you community.atlassian.com/t5/Bitbucket-questions/…
  • Praveen Kumar
    Praveen Kumar almost 6 years
    I am able to clone, push, pull using commands. I am trying to do it from IDE which I am not able to do.
  • beingmanish
    beingmanish almost 6 years
    which IDE you are using ?
  • Praveen Kumar
    Praveen Kumar almost 6 years
    Spring Tool Suite 3.9.3
  • Naval Hasan
    Naval Hasan over 2 years
    that worked for me. thanks