I'm new in the forum and also new in git, github and all the other git-things. Another person and I are using for our degree project git and github, but as I'm not a good friend of the terminal it's really driving me crazy.

Let me tell you what I've done until now:

  • Mac OS X Lion 10.7.4
  • Eclipse Indigo with EGit plugin installed
  • git installed from the graphic view on the mac
  • gitBox installed
  • github account with a repository (I created the repo by downloading github for mac and following the instructions: entering name, e-mail address, etc) --> That's how I did the configuration.
  • I started gitbox for the first time and I selected the "clone repository" option. Then entered the github repo url, then selected the location and hit accept.

Now the thing is I really don't understand how it is supposed to work, and I need to be able to link my changes in the eclipse workspace I'm working on, to the repository I have created.

When trying to create a repository from eclipse using the EGit plugin (r-click on project > Team > Share...) the repository created says: [NO-HEAD] instead of master (which is the only branch created for the repo).

Help?

2

There are 2 best solutions below

0
On

Finally, I could figured out this following this guide:

http://www.vogella.com/articles/EGit/article.html

Enjoy! ;)

1
On

Clone repository is probably not working because there is nothing to clone. The github repository is empty. As in, not even a single commit.

HEAD refers to the last commit. It means that it cannot clone it because there isn't any commit in the master branch.

You can simply initialize a new repository on your local machine. Copy files to the repository, and commit those files as an initial commit. Then, add the github URL as origin, and push changes to origin.

Not sure about the egit GUI git interface you are using, but here are the main commands you need to execute (which you can try find in the menus available):

  • "git init": create new empty repository
  • "git add .": stage/prepare all changed files to be committed
  • "git commit": commit staged files (ie. save it as a version of the files)
  • "git push": push files on current branch (master by default) to origin - if github has an empty repository, you can push anything to it.

For copying files from github back to your local machine:

  • "git pull": fetch all changes from origin, and checkout the new HEAD in your working directory

    • "git fetch": fetch changes from origin, but don't checkout the new HEAD
  • "git checkout HEAD": Checkout the head commit