Search code examples
gitgithubgit-branchgit-push

Pushing a branch to a private repo


I'm commenting some code and adding things like requirements files to it. I've cloned the repo, branched to a "documenting" branch, completed my documentation and am trying to push to the remote using:

git push origin documenting

I get an error:

 ==> git push origin documenting 
remote: Repository not found.
fatal: repository 'https://myurl/myrepo.git/' not found

Browsing to https://myurl/myrepo.git/ shows me the repo, so my URL is correct.

I tried the same command with a public repo I setup and it works. When the command is used successfully I can browse to my repo and see the new documenting branch in there with my changes.

What is the best way to fix this error? It seems like a permissions issue. Should I request permission, or is there something else I can try instead?


Solution

  • Try and compare the output of git remote -v executed in the local clone of both the private and the public repo.

    The fact that you cannot even do a git pull (meaning a git fetch + a merge) means the url associated with that private repo is somehow incorrect.

    Try setting it back

    git remote set-url origin https://myurl/myrepo.git
    

    (no trailing slash there)

    Try also a simple git ls-remote https://myurl/myrepo.git (again, no trailing slash) from any folder you want, to see if the remote access works.