Add a project to github is a pretty good git repository server for open source projects. If you have an account you can add easily a project to your github repo. At first generate the git project by executing this line in your project root:

git init

than add all files from your project to your local git repo:

git add .

Than commit everything to your local git repo:

git commit -m "init"

OK. Now you can connect your local git repo with your remote git repo by

git remote add origin<username>/<projectname>.git

Just replace “username” with your github username and “projectname” with your projectname on github. Now you can push your changes to the github repo.

git push

7 thoughts on “Add a project to github

  1. when i write git push, there is nothing.. like ;
    root@BLG-STJ-B00813:~/git# git push

    after that terminal tells ;

    ssh: connect to host port 22: Connection timed out
    fatal: The remote end hung up unexpectedly

    what’s wrong with this ? Thanks in advance

    1. You have to be in you repository when you execute the git push. And before you execute the git push you have to init the repository and add all files to a commit.

      1. I know this is actually so easy but every time i take negative messages from my terminal. Because of this i want to start from the beginning. first of all

        when i say git init :
        admin1@BLG-STJ-B00813:~$ git init
        error: could not lock config file /home/admin1/.git/config: Eri?im engellendi
        error: could not lock config file /home/admin1/.git/config: Eri?im engellendi
        error: could not lock config file /home/admin1/.git/config: Eri?im engellendi
        Reinitialized existing Git repository in /home/admin1/.git/
        after that i should add my files to my repository so I should go to my project directory so I continuing..
        admin1@BLG-STJ-B00813:~$ ls
        Belgeler file.txt~ İndirilenler out.txt~ ÜsttenDersler yedek
        examples.desktop Genel Masaüstü Resimler Videolar yedek~
        fileoutput.txt git Müzik Şablonlar workspace
        admin1@BLG-STJ-B00813:~$ cd git
        admin1@BLG-STJ-B00813:~/git$ ls file.txt
        admin1@BLG-STJ-B00813:~/git$ git add .
        fatal: Unable to create ‘/home/admin1/git/.git/index.lock’: Eri?im engellendi
        —————————– and file.txt are my projects but as you see this does not add.. I think dont need to continue more.. what do u suggest? it fails from the beginning unfortunate…

      2. You shouldn’t execute ‘git init’ in your home directory! You should execute that command in your project root!
        And the error message looks like there is already a ‘.git’ directory in your home directory.
        If you need a more detailed introduction to git I can recommend this online book:

  2. apoorv.dubey@linux-s7pe:/localdata/AdGit/MyTest> git init
    Initialized empty Git repository in /localdata/AdGit/MyTest/.git/
    apoorv.dubey@linux-s7pe:/localdata/AdGit/MyTest> git add
    Nothing specified, nothing added.
    Maybe you wanted to say ‘git add .’?

    i am getting this information when i type the above commands plz tell me how to add my project to git

    1. You just typed “git add”. That is wrong. You forgot the dot. It is “git add .”. With a dot at the end. Alternatively you can also add all files to the git repository with this command: “git add –all”.

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 )

Google+ photo

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

Connecting to %s