-3

I paste the HTTP but it doesn't work.

$ git clone https://github.com/Msajjad313/coursera-test1.git
Cloning into ‘coursera-testi’...
Fatal: unable to access 'https://github.com/Msajjad313/coursera-test1.git/': Could not resolve host: github.com
rioV8
  • 24,506
  • 3
  • 32
  • 49
M.Sajjad
  • 11
  • 1
  • 1
  • 1
  • 2
    Does this answer your question? [could not resolve host github.com error while cloning remote repository in git](https://stackoverflow.com/questions/20370294/could-not-resolve-host-github-com-error-while-cloning-remote-repository-in-git) – skaul05 Jul 14 '20 at 09:34

3 Answers3

2

What you're trying to access might not be public, so if its accessible from your git account, you will have to log in to your git account though the terminal.

First: git config --global user.name "your_username"

Then: git config --global user.email "your_email_address@example.com"

You can follow the process and read more about it HERE

  • There is nothing wrong with the repo, I can clone it without problem. No need to set credentials – rioV8 Jul 14 '20 at 13:38
1
Could not resolve host: github.com

Means you have a DNS or Firewall problem.

Try from a command line:

ping github.com

There is nothing wrong with the repo, I can clone it without problem.

rioV8
  • 24,506
  • 3
  • 32
  • 49
  • This answer guided me to `ping github.com` and got this error `ping: github.com: Temporary failure in name resolution`. Then, I found the solution at https://www.tecmint.com/resolve-temporary-failure-in-name-resolution/ , and the command `sudo systemctl restart systemd-resolved.service` did the trick. Thank you for your answer. – Felix Htoo Jun 20 '22 at 05:28
1

If you are running WSL Ubuntu and facing such kind of issues, follow the Steps below:

Step 1. Inside WSL2, create or append file: /etc/wsl.conf

Step 2. Put the following lines in the above .conf file in order to ensure the your DNS changes do not get blown away

   sudo tee /etc/wsl.conf << EOF
   [network]
   generateResolvConf = false
   EOF

Step 3. In a cmdwindow (!!), run wsl --shutdown

Step 4. Start WSL2

Step 5. Run the following inside WSL2 (line with search is optional)

   sudo rm -rf /etc/resolv.conf
   sudo tee /etc/resolv.conf << EOF
   search yourbase.domain.local
   nameserver 8.8.8.8
   nameserver 1.1.1.1
   EOF

For source of the original answer, you can proceed to the following link in askubuntu.com ->

Refer the Answer by @matson kepson

Link

Thank me later.

Lets Learn
  • 11
  • 2
  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - [From Review](/review/low-quality-posts/33009985) – James Oct 23 '22 at 13:19
  • Thanks @James for enlightening me. I am a newbie here. – Lets Learn Oct 23 '22 at 14:11
  • 1
    Answers on Stack Overflow must be written by yourself. You may quote parts of other sources, but you must make clear they are quotes, and clearly attribute your source(s). – Mark Rotteveel Oct 23 '22 at 15:05