8

I tried sharing my repository to Github in Android Studio & I get this message:

"Can't connect to the repository from the configured remote. You could want to check .git config"

If I ignore and share, Github creates an empty repository and won't upload git files. I reinstalled GitHub and created a link to git.exe in Android Studio and removed repositories with the same name on Github. But again the same message appears. So, how do I create a repository and push files on GitHub? Any help will be really appreciated.

Neeraj Sewani
  • 3,952
  • 6
  • 38
  • 55
Nandini
  • 81
  • 1
  • 4

7 Answers7

12

I tried all the above suggestion, but nothing works for me. What did work for me is "open your code editor, delete the remote origins files under vcs > git > remotes..." - the step-by-step process is given below

Step-by-step process:

1) Delete the repository from GitHub

2) Open android studio.

3) Load the file on which you were working.

4) Click on - VCS > Git > Remotes... >

5) Git remotes will popup.

6) Select the file, and click on (-) red minus sign.

7) Remove remote origins

8) Click on yes

done. now you can proceed to upload your code to the GitHub ....happy coding

Evan Darwin
  • 850
  • 1
  • 8
  • 29
Aditya Anand
  • 367
  • 3
  • 9
4

I run into the same problem yesterday. I've tried to reset AS and reinstalling Git but that, unfortunately, doesn't help, as the message keeps coming back

For some reason, when I change Git to < none > in File > Setting > Version Control, the message magically vanished when I go after that to Import into Version Control > Share Project in Github!

I was able to share my project to Github and doing all CVS operations successfully after that simple change!

enter image description here

mhadidg
  • 1,503
  • 17
  • 29
2

Check the git directory like Users/username/.git/config which has like remote["origin"], (you will find it seems like what you wanna to drop it.)

By the way, the .git is a hidden directory. You may need to do some setting.

just delete the remote like the sample:

[core]
    repositoryformatversion = 0
    filemode = false
    bare = false
    logallrefupdates = true
    symlinks = false
    ignorecase = true
[remote "origin"]
    url = https://github.com/ReZeroS/Smtp.git
    fetch = +refs/heads/*:refs/remotes/origin/*

And you should get like this:

[core]
    repositoryformatversion = 0
    filemode = false
    bare = false
    logallrefupdates = true
    symlinks = false
    ignorecase = true
Rezero
  • 150
  • 12
1

Follow these simple steps:

1. VCS => Git => Remotes
2. There would be one or more origins present of your remote VCS', hit that - sign to remove all origins of github
3.Now all the origins of github have been removed. Now try to import your project on github again. this time it will surely work.

Neeraj Sewani
  • 3,952
  • 6
  • 38
  • 55
0

Show hidden files in your project. Open .git/config. Copy any config file from another VCS/git project (that works with GIT correctly), change 'url' key in it to appropriate https link (as your current project on github). That helped me.

0

I uninstalled the .ignore plugin and the problem was solved

li.lj
  • 1
  • 1
-1

Check the git directory like Users/username/.git/config which has like remote["origin"], (you will find it seems like what you wanna to drop it.) By the way, the .git is a hidden directory. You may need to do some setting. just delete the remote like the sample:

[core]
    repositoryformatversion = 0
    filemode = false
    bare = false
    logallrefupdates = true
    symlinks = false
    ignorecase = true
[remote "origin"]
    url = https://github.com/ReZeroS/Smtp.git
    fetch = +refs/heads/*:refs/remotes/origin/*
And you should get like this:
   [core]
    repositoryformatversion = 0
    filemode = false
    bare = false
    logallrefupdates = true
    symlinks = false
    ignorecase = true

If the above does not work, delete the ".gitignore" file from your project gradle

Rob
  • 26,989
  • 16
  • 82
  • 98
dgamer
  • 155
  • 2
  • 3