0

So I'm new to Github and have been having a lot of issues with shared repositories. As of recent, I cannot push or pull after a commit has been made by another contributor.

It was working fine at first, and let me push/pull after minor commits had been made (adding view controllers, etc), but after a file is uploaded, it no longer allows me to push or pull. All other contributors are having the same issue. When I attempt to pull, I get the error "The remote repository could not be found." Any advice as to how I could go about fixing this would be appreciated.

Thank you!

R. R
  • 55
  • 2
  • 8
  • 1
    If other people have already pushed into the same remote branch you are trying to push, you could either "push --force" your version of the branch (making the remote branch forget about what the other developer(s) pushed)... or you can fetch and then merge or rebase what you did so that you are able to push normally. – eftshift0 Apr 19 '17 at 15:16
  • It won't allow me to pull, though. I want to be able to fetch and merge code so I can push normally, but I get an error when trying to pull. Am I missing something? – R. R Apr 19 '17 at 22:27
  • aaahhhh.... I guess you are missing pasting the error message over here to see what's going on ;-) – eftshift0 Apr 20 '17 at 01:35
  • My bad! The error message is "The remote repository cannot be found", followed by the suggestion of making sure the repository address is valid and that the repository still exists. I should've made that more clear. I apologize : ) – R. R Apr 20 '17 at 03:41
  • Well... I guess you should check that the URL is actually correct and you can test fetching from the remote to see if it works. – eftshift0 Apr 20 '17 at 13:55

1 Answers1

0

This may answer your question.

Because of your error code, I would recommend running git remote show origin to show the current URL of your fork (or clone) and make sure it corresponds with the GitHub URL. The error can also occur if you don't have edit permissions in a repository, be sure to double check that on GitHub as well.

Also, as Edmundo stated above, using git push --force as well as fetch -> merge may be worth a try as well.

Community
  • 1
  • 1
Carter Brainerd
  • 199
  • 2
  • 10
  • I would suggest to be careful with `git push --force` since you might end up overwriting somebody else's changes. This command could be useful in special cases but shouldn't be part of your standard workflow. – Adam Byrtek Apr 19 '17 at 21:27
  • Yeah I agree. It should be used as a last resort kind of thing. – Carter Brainerd Apr 19 '17 at 21:28
  • I'm more so looking for a way to pull the code that's already been committed and work on that, or merge the changes made by all contributors, if it's possible. We aren't touching the same pieces of code, and the error only seems to occur when one of us adds a file, as apparently the repository no longer exists under the given URL. Would there be any way to go about that? – R. R Apr 19 '17 at 22:24
  • make a copy of your current repo directory, then try `git pull --rebase` ([from here](http://stackoverflow.com/questions/14624209/xcode-git-unable-to-pull-changes-from-the-remote-repository)) – Carter Brainerd Apr 19 '17 at 22:27