14

I wrote in git Bash this

git remote -v 
origin  git://github.com/devRena/test (fetch) 
origin  git://github.com/devRena/test (push)

and when i say

git push origin master 
fatal remote error: 
You can't push to git://github.com/devRena/test.git   
Use https://github.com/devRena/test.git

How to change git://github.com/devRena/test.git to https://github.com/devRena/test.git ??

devRena
  • 327
  • 2
  • 5
  • 12
  • 1
    `git remote set-url origin https://github.com/devRena/test.git`. To change the push url only, add the option `--push`. BTW, `git push https://github.com/devRena/test.git master` also works for one time. – ElpieKay Apr 25 '18 at 10:42
  • I did it but not changed and i have the same error – devRena Apr 25 '18 at 10:52
  • git push https://github.com/devRena/test.git master fatal: remote error: You can't push to git://github.com/devRena/test.git Use https://github.com/devRena/test.git – devRena Apr 25 '18 at 10:56
  • 1
    Run `git config -l` to see if there is `url.xxx.pushinsteadof` or `url.xxx.insteadof`. – ElpieKay Apr 25 '18 at 11:03
  • there are url.https://.insteadof=git:// ,url.git://.insteadof=https:// , url.https://github.com/.insteadof=git@github.com – devRena Apr 25 '18 at 11:10
  • 2
    so it's caused by `url.git://.insteadof=https://`. Disable it from gitconfig by removing or commenting. – ElpieKay Apr 25 '18 at 11:17
  • If you want to use SSH instead of HTTPS, you need to upload SSH key first. There's a documentation here: [Connecting to GitHub with SSH](https://help.github.com/articles/connecting-to-github-with-ssh/) – Mincong Huang Apr 25 '18 at 12:04

2 Answers2

21

Check the Changing a remote's URL docs from GitHub:

Change your remote's URL with the git remote set-url command:

git remote set-url origin https://github.com/USERNAME/REPOSITORY.git

In your case, try this:

git remote set-url origin https://github.com/devRena/test.git 
nbari
  • 25,603
  • 10
  • 76
  • 131
7

You can simply edit by hand the .git/config file.

Find the section that starts with:

[remote "origin"]

Replace:

url = https://github.com/USERNAME/REPOSITORY.git

with

url https://github.com/devRena/test.git

save

dmg
  • 4,231
  • 1
  • 18
  • 24