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

  • Home
  • SEARCH
  • 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 8564139
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T17:07:41+00:00 2026-06-11T17:07:41+00:00

I am using git on my Windows 7 machine, pushing to a shared folder

  • 0

I am using git on my Windows 7 machine, pushing to a shared folder on a Server 2008 machine. This has been working perfectly for the past 6 months. However, as of yesterday, I can no longer push to the remote repo. Every time I try, I get the following:

$ git push
Counting objects: 39, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (23/23), done.
Writing objects: 100% (23/23), 8.42 KiB, done.
Total 23 (delta 15), reused 0 (delta 0)
Unpacking objects: 100% (23/23), done.
error: Couldn't set refs/heads/my-branch
To //my-server/Code/my-project.git
 ! [remote rejected] my-branch -> my-branch (failed to write)
error: failed to push some refs to '//my-server/Code/my-project.git

Googling for the ‘failed to push some refs’ error gives various results about not having pulled first (I am completely up to date), and not having the right permissions (I have full access to everything, and can create/delete/edit files in the remote repo via explorer).

I then stumbled across this blog post http://henke.ws/post.cfm/error-failed-to-push-some-refs which mentions that you might have to run some cleanup commands on the remote repository. So I ran git gc on the remote repository:

$ git gc
Counting objects: 3960, done.
Compressing objects: 100% (948/948), done.
Writing objects: 100% (3960/3960), done.
Total 3960 (delta 2971), reused 3942 (delta 2964)

And lo and behold, I can push again!

$ git push
Counting objects: 39, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (23/23), done.
Writing objects: 100% (23/23), 8.42 KiB, done.
Total 23 (delta 15), reused 0 (delta 0)
Unpacking objects: 100% (23/23), done.
To //my-server/Code/my-project.git
   8153afd..1385d28  my-branch -> my-branch

The problem, though, is that I now have to run a gc on the remote repository every time I want to do a push. If I don’t, I get the ‘failed to push some refs’ error again.

So, why is my repo so busted? How can I permanently fix the problem?

  • 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-11T17:07:42+00:00Added an answer on June 11, 2026 at 5:07 pm

    It appears that you are pushing over a windows network share, as opposed to using ssh or git protocols. This would mean your local computer has to write the files onto the network share and so could be thwarted by any locked files or permission issues relating to that server.

    When pushing a branch, after writing the objects git will update the ref for the branch by writing to the file .git/refs/heads/my-branch. It appears that file is not currently writable from your client.

    When you do a gc, refs are collected from being loose files in the refs dir and put into a text file .git/packed-refs, and the individual ref files are then deleted.

    My theory is your push is failing when the ref exists as a loose file on the server, because you do not have permissions to overwrite an existing file, whilst you do have permissions to create new files. After packing the refs with a gc, the ref file no longer exists and thus you are able to push again, once.

    My suggested fixes are:

    1. Verify whether you can overwrite existing files from you client and if not fix permissions or file locking problems
    2. Switch to using the git protocol, this blog seems like a good overview of options for windows http://freshbrewedcode.com/derekgreer/2012/02/19/hosting-a-git-repository-in-windows/

    As a last resort, if you find yourself stuck with the gc option, you could try running ‘git pack-refs -all’ instead. It will be faster than fixing the problem with a gc each time.

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

Sidebar

Related Questions

Pushing my first_app to git hub using cygwin on a windows 7 machine. Using
I'm trying to send a cURL request from a Windows Server 2008 machine using
I have a git repository on Unfuddle , and a Windows machine I'm using
I have a git repository on unfuddle.com. I've been working locally on my windows
I'm working to a project in git. In Windows, I'm using git extensions to
I'm using Git now from my Windows machine. I clone the repo, do some
I'm using git bash on a windows 7 machine. When I try to use
I'm using git to manage files in a local directory on a Windows machine
I just installed git on my windows machine using git's how to guide ,
I'm using msys Git for source control on a Windows machine and I'm trying

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.