Importing project from computer to GitHub repository

Tried to find this but did not find any straightforward way to do it.
I am trying to import project from my computer to GitHub repository. Repository is already created by sysadmin and its currently empty.

I know there is another way that I can clone the repository to my computer then copy my project folder to that folder and then commit push. but this approach will require me to change project location in eclipse also by again importing project from the new location.

  • Moving git branch to another local repo
  • How to overcome git merge history ambiguity/obfuscation with '--ours'?
  • Git subtree: Use only subrepository instead of whole repository
  • How to install git repository on Bluehost
  • Using Git as a source control for webdevelopment and multiple environment
  • Ignore git directory
  • I don’t want that. Is there an easy way I can just push the project to the repository from my current location on my computer.

  • Shifting all code from master to a new branch and removing the code from master
  • “Will not add file alias 'samefile' ('SameFile' already exists in index)” when `git add` operation
  • Git: how to push changes made to only certain files?
  • Undoing 'git reset <sha>'
  • Is this workflow possible with git-svn?
  • Git push rejected after cloning
  • 2 Solutions collect form web for “Importing project from computer to GitHub repository”

    From the Github documentation:

    Push an existing Git repository
    >cd [existing_git_repo on your computer]
    >git remote add origin[username]/[project_name].git
    >git push -u origin master

    Note that it does need to be an empty project in Github without having to do any conflict resolutions.

    Your Project doesn’t use git

    • In Terminal, change the current working directory to your local project.

    • Initialize the local directory as a Git repository.

      $ git init

    • Add the files in your new local repository. This stages them for the first commit.

      $ git add .

      This adds the files in the local repository and stages them for commit
      Commit the files that you’ve staged in your local repository.

      $ git commit -m 'First commit'

      Commits the tracked changes and prepares them to be pushed to a remote repository
      Copy remote repository URL field at the top of your GitHub repository’s Quick Setup page, click to copy the remote repository URL.

    • In Terminal, add the URL for the remote repository where your local repostory will be pushed.

      $ git remote add origin remote repository URL

      Sets the new remote

      $ git remote -v

      Verifies the new remote URL

    • Push the changes in your local repository to GitHub.

      $ git push origin master

      Pushes the changes in your local repository up to the remote repository you specified as the origin.

    Your project already uses git

    • If this is the case you need steps 1, 5 and 6.

    You can find more info about adding projects to GitHub on official docs.

    Git Baby is a git and github fan, let's start git clone.