3

I am trying to push into a repository, and it does exist and the link is correct. I am trying to force for it to ask me for username and password because I think something is wrong with that. This is the error:

λ git push origin master --force -v
Pushing to https://github.com/wojlive/liveandnow.git
remote: Repository not found.
fatal: repository 'https://github.com/wojlive/liveandnow.git/' not found
Przemek
  • 794
  • 3
  • 17
  • 41
  • Public or Private? – Hamza Anis May 31 '17 at 15:46
  • it is private but even when i make it public it doesn't work – Przemek May 31 '17 at 15:46
  • what error do you get when you make it public? Do you still get the not found error, or do you get a username / password error? – victor May 31 '17 at 15:47
  • still not found – Przemek May 31 '17 at 15:48
  • so not found error tells me its not to do with your credentials, im betting you have a typo or syntax error in your git url – victor May 31 '17 at 15:49
  • try `git remote rm origin` and then `git remote add origin https://github.com/wojlive/liveandnow.git/` – Hamza Anis May 31 '17 at 15:49
  • try just cloning the repo: git clone https://github.com/wojlive/liveandnow.git – victor May 31 '17 at 15:49
  • well if I have copied the url there is no way it's a typo. it probobly is with credentials that's why I try to do -v to get it to force it – Przemek May 31 '17 at 15:50
  • λ git clone https://www.github.com/wojlive/liveandnow.git Cloning into 'liveandnow'... remote: Repository not found. fatal: repository 'https://github.com/wojlive/liveandnow.git/' not found – Przemek May 31 '17 at 15:50
  • 1
    Normally GitHub gives a 403 for bad auth, so I suspect network more than credentials. However, pursuing the credentials route, run `git config --list` and post back any `credential` entries (ex `credential.helper`), and check for [_~/.git-credentials _ or _$XDG_CONFIG_HOME/git/credentials_](https://git-scm.com/docs/git-credential-store#FILES) – vossad01 May 31 '17 at 16:07
  • user.name=u1358595 so it is wrong how can that be changed? // it does give me error 403 now – Przemek May 31 '17 at 16:16
  • An update to your question with the current output might help in getting an answer. `user.name` is not used for authentication. If you are not being prompted for credentials see https://stackoverflow.com/q/15381198/1072626. – vossad01 May 31 '17 at 16:48
  • Double check the credentials being used. It is possible that you're not specifying credentials, and the stale ones are being picked from the git-credential. Git(Hub?) will tell you that the repository does not exist even we don't have permissions to access it, which is a sane thing to do, to prevent probing attacks. – Manav Jan 18 '18 at 09:53
  • this is misleading tip, the reason of failure is your current account has no privilege to push, grant push privilege or try `git remote add origin` with correct account in url – http8086 Dec 24 '20 at 12:53

3 Answers3

2

The trailing slash error (afaik) can't be removed just by entering the same origin again. In my case, unsuccessfully, I removed my remote, then added it again:

git remote remove origin  
git remote add origin https://github.com/andybywire/jekyll-foundation.git

But when I tried to push my changes, I still got the error:

fatal: unable to access 'https://github/andybywire/jekyll-foundation.git/': Could not resolve host: github

... trailing slash intact. After some further investigation I noticed that some of my other repos leave the .git off altogether:

git remote -v
origin  https://github.com/andybywire/content-first-prototyping (fetch)
origin  https://github.com/andybywire/content-first-prototyping (push) 

When I removed the .git from the first repo, the error went away entirely:

git remote remove origin  
git remote add origin https://github.com/andybywire/jekyll-foundation

This repo now allows me to do everything I would expect.

I don't know why, but I also went round and round with this (restarts, proxy settings, toggling wi-fi); this is what worked.

GEOCHET
  • 20,623
  • 15
  • 71
  • 98
andybywire
  • 21
  • 5
1

Try removing the trailing slash on your URI.

git remote remove origin
git remote add origin https://github.com/wojlive/liveandnow.git
Matt Clark
  • 24,947
  • 16
  • 62
  • 114
0

This also works. Avoids the slash altogether.

git remote add origin git@github.com:YOUR_USERNAME/NEW_REPO.git

The result of this command can be seen in git config -l:

...
remote.origin.url=git@github.com:YOUR_USERNAME/NEW_REPO.git
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.master.remote=origin
branch.master.merge=refs/heads/master

(If needed), create a new repo first: Is it possible to create a remote repo on GitHub from the CLI without opening browser?

Monte Hayward
  • 439
  • 2
  • 10