How to create a new repository on the command line in Github

On your Git Hub profile click “new repository”

brief description, choose the “public” repository option, and click “create repository”.

1)In the command line–make sure you cd into your folder–and type:

 $ git init

This initializes a git repository in your project





2)Next check if a file called READEME.rdoc exists in your directory:

 $ ls README.rdoc

If the file doesn’t exist, create it by typing:

 $ touch README.rdoc






3)Then type:

 $ git status

This will list out all the files in your working directory.

4)Then type:

 $ git add .
 OR
 $ git add filename.extension

This adds all of your files & changes.

5)Then type:

 $ git commit -m "first commit"

This commits all of your files, adding the message “first commit”













6)Next type:

 $ git remote add origin https://github.com/username/rails-girls.git

This creates a remote, or connection, named “origin” pointing at the GitHub repository you just 
created.




7)Then type:

 $ git push -u origin master

This sends your commits in your “master” branch to GitHub








If you want to continue making changes and pushing them to GitHub you’ll just need to use the following three commands:

 $ git add .













 $ git commit -m "type your commit message here"

 $ git push origin master




Comments

Popular posts from this blog

AttributeError: Got AttributeError when attempting to get a value for field `abc` on serializer `PfleSerializer`. The serializer field might be named incorrectly and not match any attribute or key on the `QuerySet` instance. Original exception text was: 'QuerySet' object has no attribute 'abc'.

ImportError: No module named regex