Lee
Lee

Reputation: 422

Git Tag failed with code 128: fatal: unterminated line in .git/packed-refs

I am having an error in SourceTree that says, "Error Encountered: 'git tag' failed with code 128: fatal: unterminated line in .git/packed-refs" If anyone has seen this error and knows a solution I would be grateful.

Upvotes: 14

Views: 16467

Answers (6)

Krishna Santosh Nidri
Krishna Santosh Nidri

Reputation: 440

Deleting .git/packed-refs file should fix the issue.

Upvotes: 1

user3054804
user3054804

Reputation: 21

Probably won't be everybody's fix, but I went into the file and looked at it with VS Code text editor and noticed it only had thousands of null characters, so I just deleted all of them an saved. Seemed to do the trick.

Upvotes: 1

aspnetdeveloper
aspnetdeveloper

Reputation: 647

I know this question is from a while ago but I ran into this issue today, so just wanted to post what I did to resolve it in case it helps someone. I uninstalled and installed the latest Sourcetree version and the error went away.

Upvotes: -1

Moorthyfolio
Moorthyfolio

Reputation: 31

if did't see .git/packed-refs folder from flutter just delete flutter SDK and extract new SDK same folder

Upvotes: 3

Arita Roman
Arita Roman

Reputation: 11

Just delete the file .git / packed-refs. from the flutter folder

Download the sdk again from https://flutter.dev/docs/get-started/install/windows and copy the folder to the flutter location, in this way files were mixed and everything worked correctly.

Upvotes: 1

TT--
TT--

Reputation: 3195

Just delete the file .git/packed-refs.

Then "refresh" your repo with a pull or fetch.

I had the same error fatal: unterminated line in .git/packed-refs: ...

(And that file was just lines of:

0000 0000 0000 0000 0000 0000 0000 0000)

In my case deleting the file worked and I was able to use my repo again.

Failing the above, I would try something like mentioned in this answer. The steps are:

  • move old git directory
  • initialise new repo
  • link to old repo (by remote add origin)
  • get old history (fetch)
  • force update to old history (by doing a reset)

Upvotes: 26

Related Questions