Using GitHub: Local Repo

This first version of this post might be clunky to say the least.

Okay, my latest volunteer gig is with Mil-OSS. Specifically, I’m creating a website for the Central Florida chapter. One of the leaders created a GitHub repository and added me as a collaborator. Now I need to create a local repository and upload my shizzle.

I could be wrong, but I don’t think you can just git init in a folder of your files and upload them to a GitHub repo. This seems to be the process for  uploading files you’ve created before creating (or being added to) a GitHub repo. It’s especially irritating if, for example, you’ve configured your Site/Server settings in Dreamweaver.

  1. Navigate to the folder in which you’ll clone the remote repo by typing cd and the path to the folder.
  2. Clone the remote repo locally by typing git clone and the SSH stuff on the repo page at GitHub.com.
  3. Move all the files you’ve created into the new folder that creates — your new local repository (via the command line or drag & drop).
  4. Navigate into that local repo via cd.
  5. Tell Git you want to add all these new files to your next commit by typing “git add .” (no, don’t include the quotes but, yes, include that period).
  6. Commit those files by typing git commit -m “<message>” where <message> (yes, this time include those quotes) is notes to yourself about the commit (what the latest changes are, for example). The -m tells Git that you’re including the message part.
  7. Push your files to the remote repo by typing git push <your SSH shizzle> master.

Much Easier Method!

Update May 16, 2016: Found this yesterday after making the mistake of thinking that cloning someone else’s project would automatically create a repo on GitHub (nope, that’s “forking” … I think). You simply create the new remote repo on GitHub and type the following into the terminal:

git remote add origin <URL>
git push -u origin master

Advertisements

About jotascript

Aiming to please. Seeking to impress.
This entry was posted in GitHub, Open Source. Bookmark the permalink.

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s