TransWikia.com

error: failed to push some refs to 'https://github.com/

Stack Overflow Asked by koeradoera on February 7, 2021

this is my repository
https://github.com/kiotie32/artbit-text.git
when I do

$ git push -u origin master
remote: Repository not found.
fatal: repository 'https://github.com/kiotie32/arbit-text.git/' not found

I am on a Windows 10 machine. I had configured ssh keys to be used with this laptop.
I do an ls and I can see

 MINGW64 ~/.ssh
$ ls
kiotie32_rsa  kiotie32_rsa.pub  known_hosts

I read all the answers given on this thread
I changed the password stored in windows credential manager.

I check git remote -v | head -n1 | awk '{print $2}' | sed 's/.*///' | sed 's/.git//'
I get following output arbit-text

I changed the password stored in windows credentials manager probably an old password was stored.

I do not get any popup asking username password. (an ssh key was configured but not sure if that is working on this Windows 10 environment I have the key stored in .ssh in git bash)
Now I do

$ git remote add origin https://github.com/kiotie32/arbit-text.git
fatal: remote origin already exists.

then I do

$ git push -u origin master
error: src refspec master does not match any
error: failed to push some refs to 'https://github.com/kotie32/arbit-text.git'

So I am not able to understand why this error is coming/

I tried the solution here https://stackoverflow.com/a/7572252/13012032 first answer to do
git commit -m "initial master"
and then I got
$ git push origin master remote: Repository not found. fatal: repository 'github.com/kotie32/arbit-text.git' not found
then I tried as in comments
git add -all and then I did
$ git push origin master remote: Repository not found. fatal: repository 'https://github.com/kotie32/arbit-text.git/' not found

then from another answer https://stackoverflow.com/a/4183856/13012032 I tried
$ git show-ref
79d1730e9aa78f68a11ec4de6a0e8d6b66f17afb refs/heads/master

then I did
$ git push origin HEAD:master
remote: Repository not found.
fatal: repository 'https://github.com/kotie32/arbit-text.git/' not found

I notice in the last error on above url spelling kotie32 is wrong it should be
kiotie32
checkd the config file inside the .git folder
and there I see the following

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

so here url is corrrect the spelling is kiotie32 which is correct.

ok I now noticed that 2 directories have formed.
project folder/.git/.git
and config file of <project folder>/.git has wrong url
and the inner one i.e. <project folder>/.git/.git has correct url.

I changed the config file of <project folder>/.git and deleted subdirectory .git/.git
the new config file has

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

and then I again do

$ git push -u origin master
remote: Repository not found.
fatal: repository 'https://github.com/kiotie32/arbit-text.git/' not found

then I did

$ git remote set-url origin https://github.com/kiotie32/artbit-text.git

then now I am able to push to master branch.

8 Answers

Usually I get this error message when trying to "git push" command. Run the following command

git add --all

Then

git push -u origin main

It should solve your issue. Hope it helps!

Answered by Sahana on February 7, 2021

check maybe you are trying to push without commiting. try to commit you changes.

git commit -m "my commit"

or type git branch to see if you have set the remote url. if nothing shows up, then add the remote origin url git remote add origin https://github.com/username/projectname.git. then try git push origin master

Answered by bimeri noel on February 7, 2021

I had the same problem but this command resolved it.

Replace:

git push -u origin master

with following command:

git push -u origin main

Answered by Amitesh mani tiwari on February 7, 2021

I faced the same error. Then, I realized that original branch is not call original anymore. Then, I tried this code and it worked:

git push origin main

just replace master with main.

Answered by milad on February 7, 2021

One more thing (just in case this may help somebody in the future): You gotta have a commit to push.

Answered by LuisE on February 7, 2021

try with this command:

git push

confirm user name and password and done.

Answered by Jair Manosalva on February 7, 2021

This error could have occured in following scenarios as well

  1. If you have changed your github username, password or email
  2. If you are trying to push commits to someone else's branch while your windows is configured with your github credentials

I have got this error in above scenarios, and this is how i solved it

  1. Deleted github credentials stored in Credential Manager in Windows

  2. After that, I tried to push my commits again with following command, and then it prompted me to enter github credentials. (if you are pushing to someone else's repo, make sure that you enter the credentials of that github user's account

    git push -u (repo-url) (branch-name)

Answered by Sankha Rathnayake on February 7, 2021

Just give a try to the following command:-

git push origin master --force

Hope, it helps! Thanks!

Answered by Arun Kumar N on February 7, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP