The below text contains a necessary commands on how to initialize a git repository with Github. Here we assume that you have created a new repository using your Github account and now you wish to push your project files into this new Github repository. In order tu push your files to a new Github repository we need to initialize it our new repository locally.
First, navigate to your project directory containing all files:
$ cd /my/project/directory
Then, initialize git:
$ git init
This will create a
.git directory and you next ready to add remote origin. This will be the URL provided to you on Github repository page. eg.
https://github.com/linuxconfig/apt-cacher-ng.git. Use your link to add remote origin:
$ git remote add origin https://github.com/linuxconfig/apt-cacher-ng.git
Perform a initial pull as there may already be some files such as License or README to merge:
# git pull -u origin master
Now, we are ready to add, commit and push our project files:
$ git add * $ git commit -m 'Initial commit' $ git push -u origin master