Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7768861
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T16:01:40+00:00 2026-06-01T16:01:40+00:00

I have a repository on GitHub located here . I created a working branch

  • 0

I have a repository on GitHub located here. I created a working branch for someone and they forked the repo, made some changes on the working branch and submitted a pull request.

I tried the changes and everything was good and since GitHub was offering to automatically merge the pull request, I went ahead and click the big, green “Merge Pull Request” button. All was well there except that the changes to the working branch were applied to the master branch which I can live with.

The problem is now that the repository cannot be fetched by me or anyone else. I get this error:

dp@dpub:/tmp/gh$ git clone git://github.com/dapphp/securimage.git
Initialized empty Git repository in /tmp/gh/securimage/.git/
remote: Counting objects: 333, done.
remote: Compressing objects: 100% (269/269), done.
remote: Total 333 (delta 91), reused 297 (delta 55)
Receiving objects: 100% (333/333), 3.91 MiB | 2.78 MiB/s, done.
Resolving deltas: 100% (91/91), done.
error: refs/remotes/origin/master does not point to a valid object!
error: Trying to write ref refs/heads/master with nonexistant object 31d684d383913c4cf1a0d5ff0691c2c163284a35
fatal: Cannot update the ref 'HEAD'.

This results in no directory being created or any working files getting downloaded. I’ve searched all over for possible ways to resolve this but most talk about issuing commands to the git repo which I cannot do because I can’t get a copy of the repo in the first place.

I’ve found I can still clone a remote branch using something like this: git clone -b audiofixes git://github.com/dapphp/securimage.git but I still get an error about the bad ref and I can’t figure out any commands I can run to fix the problem. I’m willing to undo the changes if necessary.

In case it helps, once I clone a different branch, here is the output of git branch -a:

* audiofixes
  remotes/origin/2.0.2
  remotes/origin/3.0
  remotes/origin/HEAD -> origin/master
  remotes/origin/audiofixes
  remotes/origin/securimage_flash

At this point I really have no idea what (if anything) I can do to fix the state of the repository.

Thanks for any suggestions.

EDIT: Some command output as requested.

$ ls .git/refs/remotes/origin
HEAD

$ ls .git/objects
info/  pack/
# info is empty, pack has pack-b8add06e9a6864ea44a58c06b8bd549eedd90c94.idx and pack-b8add06e9a6864ea44a58c06b8bd549eedd90c94.pack

$ cat .git/refs/remotes/origin/master
cat: .git/refs/remotes/origin/master: No such file or directory

$ cat .git/refs/remotes/origin/HEAD 
ref: refs/remotes/origin/master
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T16:01:41+00:00Added an answer on June 1, 2026 at 4:01 pm

    NEW:

    Apparently 1) github does not give ssh access :(, and 2) it’s impossible to share reflogs between different machines through git protocol.

    So… You already created a ticket apparently, but you don’t necessarily need them to fix the repository. All you need is for them (since they have privileged access) to run git reflog master on the server’s repo and then paste the results for you to view. In that file, look for the previous SHA-1 value of master (since the current one doesn’t seem to work). Once you have that, you (I think) can do the following (on your own computer):

    $ git checkout -b temp
    $ git update-ref refs/heads/temp $SHA1
    $ git push -u origin +temp:master
    

    This will undo the merge operation on the server.

    You may be able to get the previously working SHA1 without having to get the reflog from the server. In your local repo (or your friend’s local repo), the previously working commit does exist somewhere in there. If you can figure out a way to find it there, then you can proceed with the above suggestion.

    OLD: Here is my first thought. If you are able to copy the .git/logs directory from the server, then that will have stored in it all the previous values of the master branch. Specifically, the file .git/logs/refs/heads/master will be a raw text file with the previous values of that branch. For example (I don’t know if github allows you to do this or not):

    $ git clone https://github.com/dapphp/securimage.git -b audiofixes
    $ scp github.com:/dapphp/securimage.git/logs/refs/heads/master .git/logs/refs/remotes/origin/master
    $ git update-ref refs/remotes/origin/master refs/remotes/origin/master@{1} #see "Date Spec" section of http://book.git-scm.com/4_git_treeishes.html
    

    that should theoretically change the value to what master was previously. However it will only do that locally and will not actually change the value on the server, which is what we really need. So if you could ssh directly to the server and just run that last command there, that would (again, theoretically) fix the problem for good by simply undoing the merge.

    .

    This is all that I can think of on top of my head. But I really like solving git puzzles like this, so I’ll let it sit in my head for a bit longer 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a repository in Git. I made a branch, then did some changes
I have a repository on github, and someone else has forked it and made
I have forked a repository on github some time ago, made a small change
I have a forked github repository (call it repo-O and call my fork repo-F)
I have a remote repository http://github.com/fernandezpablo85/Test This repo has a master branch, but it's
I have forked a branch from a repository in GitHub and committed something specific
I have ONE repository on GitHub , let's call it Repo-1 . I want
I have main repository at github. I have created a fork. I created a
I am very new to GitHub. I have created a GitHub repository and pushed
I created a new repository in Github to share my vimfiles. But there's some

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.