What is GitHub? The first question is what is git? Git is a decentralized version control system created by Linus Torvalds that is used by a number of open source projects, most notably perhaps the Linux kernel. GitHub is a new hosted Git repository service that's being called a "social network" for programmers and with good reason. It also already has some high profile projects of its own on board: Ruby on Rails, Capistrano, Merb, Prototype and Scriptaculous, among others.
I have been asked how do you upload to github. Keep in mind these are repos that you are uploading. There is no direct uploading that I am aware of. The best was is to use 3rd party packages like GIT which will allow you to upload your code from shell.
Once you login to github and create your repo, you will see the following instructions:
Create a new repository on the command line
touch README.md git init git add . git commit -m "first commit" git remote add origin email@example.com:linuxterminal/repotest.git git push -u origin master
Push an existing repository from the command line
git remote add origin firstname.lastname@example.org:linuxterminal/repotest.git git push -u origin master
Once you have the information above from github, then you are ready to get started with uploading to github. Install GIT from there downloads here. To install you can use the following:
$ apt-get install git-core
$ yum install git
$ emerge --ask --verbose dev-vcs/git
$ pacman -S git
$ cd /usr/ports/devel/git
$ make install
Solaris 11 Express
$ pkg install developer/versioning/git
$ pkg_add git
Please see image below for example:
Once you have this installed, you can now run "git" commands with shell. From here you will want to create your repo directory. I placed mine in '/home/user/Documents/GitHub/repotest'. Here you can add your repo files. For an example I added README.md and echo'd the following:
test-repo ===== Installation ------------- This is just a test repo. Description on how to upload to GitHub from Linux. Extra ------------ Ubuntu Linux to Github
Once you have your README.md file created, you can then run the commands provided when you created your repo. Before hand you will want to setup your global config for github. Use the following commands to setup your username and email address:
#Setup your name with GitHub git config --global user.name "Your Name" #Setup your email address with GitHub git config --global user.email "email@example.com"
At this point you may need to setup a SSH Key between your local box and GitHub. You can add your SSH Key once generate to GitHub here. At this point you can run the commands provided to you after creating your repo.
touch README.md git init git add README.md git commit -m "first commit" git remote add origin firstname.lastname@example.org:linuxterminal/repotest.git git push -u origin master
View example below:
Few recommendations for this. When you go to "git add README.md," you can run "git add ." so git will fetch all files within that directory. Also you may run into issue with pushing if you are the root user. Run as non-root should work as normal.
If all goes well, you should see the following in order:
user@ubuntu:~/Documents/GitHub/repotest$ touch README.md user@ubuntu:~/Documents/GitHub/repotest$ git init user@ubuntu:~/Documents/GitHub/repotest$ git commit -m "first commit" user@ubuntu:~/Documents/GitHub/repotest$ git remote add origin email@example.com:linuxterminal/repotest.git user@ubuntu:~/Documents/GitHub/repotest$ git push -u origin master Counting objects 3, done. Compressing objects (2/2), done. Writing objects: 100% (3/3), 328bytes, done. Total 3 (delta 0), reused 0 (delta 0) To firstname.lastname@example.org:linuxterminal/repotest.git * [new branch] master -> master user@ubuntu:~/Documents/GitHub/repotest$
Then you should be able to see your file(s) on GitHub. Example image below:
If you have any questions, please feel free to comment below. The steps can get a little confusing but this tutorial should assist with that. Thanks.