Adding an existing project to GitHub using the command line

  1. Create a new repository on GitHub. To avoid errors, do not initialize the new repository with README, license, or gitignore files. You can add these files after your project has been pushed to GitHub.
  2. Open Terminal.
  3. Change the current working directory to your local project.
  4. Initialize the local directory as a Git repository.
  5. Add the files in your new local repository. This stages them for the first commit.
  6. Commit the files that you’ve staged in your local repository.
  7. At the top of your GitHub repository’s Quick Setup page, click to copy the remote repository URL.
  8. In Terminal, add the URL for the remote repository where your local repository will be pushed.
  9. Push the changes in your local repository to GitHub.

You can add rock as a submodule of slingshot. In the slingshot repository:

git submodule add rock

At this point, you’ll have a rock folder inside slingshot, but if you were to peek inside that folder, depending on your version of Git, you might see … nothing.

Newer versions of Git will do this automatically, but older versions will require you to explicitly tell Git to download the contents of rock:

git submodule update --init --recursive

If everything looks good, you can commit this change and you’ll have a rock folder in the slingshot repository with all the content from the rock repository.

About Tang

A mobile developer, work in Stockholm, Sweden
This entry was posted in git, Mac, Mobile. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s