[Tutor] Questions (and initial responses) on using version control: Why cannot I push my single (master) branch to origin without an error occurring?

boB Stepp robertvstepp at gmail.com
Sun May 3 04:58:29 CEST 2015


On Sat, May 2, 2015 at 3:15 AM, Albert-Jan Roskam <fomcl at yahoo.com> wrote:

> Check out this page:
> http://stackoverflow.com/questions/7861184/what-is-the-difference-between-git-init-and-git-init-bare
>
> Isn't the error you mentioned before the same?

After reading everything on the page you link to, plus the little bit
on Git in "Introducing Python" by Bill Lubanovic, I think I understand
what is going on a bit better. My current understanding is this: The
workflow that I originally did resulted in TWO working directories
being created with the same branch name, master; one where I meant the
remote repository to be and one where I really meant for my work to be
done. The error message reflects that Git will not allow both working
directories to be working on the same branch at the same time, as Git
has to allow for others wanting to access the repository and the
branch master. Thus when I created a new branch on the repository and
checked it out, there was now only one working directory actively
developing the master branch, *not* at the repository's location. The
repository's working directory was then set to have the new branch
developed. Of course this was a throw away branch, to allow me to push
to the repository from my *real* working directory. I don't know if I
am saying this particularly well as I am still wrapping my mind around
how Git structures things.

I could have done one of two things:

1) Created a repository using "git init", and have my working
directory there. In this instance, there would be no need for push or
pull commands. Or,

2) Created a bare repository. This would result in there being NO
working directory in that location. Go to my desired working directory
location and type "git init". Create files, edit them, etc.,
adding/committing them there. When I am ready to push, I can push to
the remote "bare" repository. No error messages result as no working
directories exist on its location.

My intent in having my work stored on two different hard drives, was
to cover myself if one hard drive failed. So I tested arrangement (2)
tonight. After generating some test files and pushing them to the
remote directory, I grew concerned when I did not see any of the files
I pushed there! But I followed through and deleted everything off of
my working directory hard drive to simulate it crashing. While still
there I typed "git clone remote_repo_location" and voila! My files
returned!! I don't totally understand everything yet, but it makes a
lot more sense now.

boB


More information about the Tutor mailing list