philologon
philologon

Reputation: 2105

Reset local git repository

A few days ago I created a repository on Github, then followed the steps to add my existing solution to it. I have no idea what I did wrong, but after a few random 'git add' commands and whatnot, I now get the message in github for windows:

failed to sync this branch.
You might need to open a shell and debug the state of this repo.

Not gonna happen.

A better idea is that I delete the repository at github and start over with my local repository. I know how to delete the repository on github (I know it is easy because I have already done this once.) I am not sure how to start over locally. Is there a git command that is basically "git uninit" or "git deconstruct repository" ?

Upvotes: 28

Views: 59283

Answers (6)

AlanMo
AlanMo

Reputation: 171

git windows even can't clone the repo for me regardless I can clone it in git shell. I fixed it by following steps:

  1. uninstall git for windows.
  2. restart windows.
  3. install git for windows.

without restarting windows won't solve the problem, I did try.

Upvotes: 0

Jason Shehane
Jason Shehane

Reputation: 423

I got this error on GitHub for Windows when I had lost internet connection. Once I got connection back it sync'd up fine. Apparently the error messages on the windows client just aren't descriptive enough to tell you when you've lost connectivity. It was as simple as that.

Upvotes: 2

Avi
Avi

Reputation: 1381

  • First Go to your local repo
  • Show Hidden Files.
  • You will see a ".git" named folder in your local repo.
  • Delete That.
  • Now open Github for Windows.
  • If you click on that repo in Local Tab, you should get an Error that repo cant be found.
  • There is it, click on Re-Clone Repository button.
  • The Repo will be downloaded again and saved by default in My Documents/GitHub.

Upvotes: 9

thinktt
thinktt

Reputation: 363

I'm pretty sure I found this in another stackoverflow (if I see that one I'll put the link here) but restarting Windows actually fixes this problem for me. If I remember right, this is related to Github for Windows updating.

There may be another way to get the app to update correctly and sync without restarting. Everytime I've had this issue though, restarting Windows fixes it.

Upvotes: 0

MTT
MTT

Reputation: 318

There is another option that does not involve using the command line. It goes without saying that yes, you should know how to use it but if you are just learning it's not that simple.

Download TortoiseGit and right-click on the folder containing the repo. Go to TortoiseGit > Push and enter your login details. Badabing.

I use it in tandem with the Github client. Life is easier/quicker now.

Upvotes: 0

Matt Greer
Matt Greer

Reputation: 62057

Git stores everything about a repo at the repo's root in the hidden .git folder. Simply deleting that folder, rm -rf .git makes it as if there never was a repo there.

Upvotes: 60

Related Questions