tags:

views:

227

answers:

2

I have a directory with all my coding projects. I want to upload (right word?) it to github using command line.

I already looked at this question. I know how to clone an existing project, and how to push it after making any changes.

But in this case, I want make a new project and add files to that. How to I do it (using command line)?

+6  A: 
git init
git add .
git commit -m "Initial commit"

After this, make a new GitHub repository and follow on-screen instructions.

Veeti
@Veeti: So, the repository willbe created using GitHub gui only, not through command line?
Lazer
@eSKay: you'll first have to have a local repo, then add a remote to it, and push to that remote. All of this is done from the command line. Pushing to github has some pre-requisites, such as creating a project on github and adding ssh keys to identify yourself.
hasen j
+3  A: 

If you haven't already created the project in Github, do so on that site. If memory serves, they display a page that tells you exactly how to get your existing code into your new repository. At the risk of oversimplification, though, you'd follow Veeti's instructions, then:

git remote add [name to use for remote] [private URI] # associate your local repository to the remote
git push [name of remote] master # push your repository to the remote
Rob Wilkerson