Wednesday, May 1, 2013

Import local source code into empty repository using GIT

Today I just setup Bitbucket account, feeling so excited to give it a try. Setting up account is as easy as one two three. When come to import the existing code from my local hard drive into my own remote repository, Git give me a surprise!!

fatal: Not a git repository (or any parent up to mount point /home)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

What kind of nasty error is this? This seem to me that Git couldn't find any Git info on my workspace. I think this could be a false alarm because I don't have any local Git repository being setup yet. There should be some configuration need to be done.

Searching in I found a guide on how could I import the source from local to Git repository without 'cloning' the remote first. Put in other words, I have the empty repository created then only I push my source into it.

Here is the step:
  1. Create the remote repository.
  2. git init.
  3. git add.
  4. git commit -m "initial commit".
  5. git remote add origin .
  6. git push origin master.
After the source is being push into the repository, following output should be seen.
Counting objects: 34, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (22/22), done.
Writing objects: 100% (34/34), 6.57 KiB, done.
Total 34 (delta 3), reused 0 (delta 0)
remote: bb/acl: huahsin68 is allowed. accepted payload.
 * [new branch]      master -> master

No comments: