bibiki
bibiki

Reputation: 13

cloning and pushing back to a .git file, not .git directory

Alright, I understand that error: failed to push some refs to is a common issue in git and that there is a lot of material online about it, but nothing is helping. So let me explain the issue:

I was given a name.git file, not a folder. I did:

git clone name.git name This generated my name directory with the code I worked on it, have made a series of commits. Nothing left to be committed. (this is all on my local machine, so no one committed in the meanwhile, but...) I still did git pull. Already up to date. OK then, git push and it responds error: failed to push some refs to.

Now, I need to make my commits available to other people. I know, I can just rar/zip my name directory, but I wanted to actually have a name.git file to give back that would include the logs of my commits. Anyone has any idea what is happening?

Upvotes: 0

Views: 141

Answers (1)

starlocke
starlocke

Reputation: 3681

I think I understand it now.

You probably received a "git bundle", and a git bundle simply doesn't like being pushed-to, apparently.

Taking cues from: http://rypress.com/tutorials/git/tips-and-tricks

Note - Assume you can use the Linux-esque touch command to create a plain empty file

Create new project:

mkdir foo
cd foo
touch hello
git add .
git commit -m "first commit"

Create bundle:

git bundle create ../foo.git master

Make use of bundle:

cd ..
git clone foo.git foo-clone -b master
cd foo-clone
touch world
git add .
git commit -m "second commit"

Try to push to bundle, but fail:

git push origin master

error: failed to push some refs to [foo.git]*

* foo.git path is actually expanded out

Therefore, maybe you could also bundle up your repository and ship it back to your upstream.

Addition - You could also submit a "git-format-patch" style of patch upstream, too; it will be far less heavy than a bundle.

Alternatively, you and your team can explore solutions like GitHub, GitLab, and BitBucket

Note - GitLab and BitBucket have options for "local install, total privacy".

Upvotes: 1

Related Questions