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 dogit 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 commentsgit 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.
If you get a failed to push some refs to error, the main thing to do is git pull to bring your local repo up to date with the remote. Avoid employing the --force flag when using git pull and prevent other developers' accidental overwrites of committed features.
This means that someone else pushed a commit to the same branch you're pushing to, but you don't have that commit on your laptop yet. This can happen if it has been awhile since you ran "git pull" on a branch that many people contribute to, such as staging. To fix this issue, run: git pull origin <your-branch>
In the command line, navigate to the root directory of your project. Initialize the local directory as a Git repository. To create a repository for your project on GitHub, use the gh repo create subcommand. When prompted, select Push an existing local repository to GitHub and enter the desired name for your repository.
I had the same problem but this command resolved it.
Replace:
git push -u origin master
with following command:
git push -u origin main
or
git push -f origin main
                        Just give a try to the following command:
git push origin master --force
                        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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With