Github is a free (if visible to public)
internet based software respository and there are lots of open source software
on the site. In this blog, we are going to introduce how to use github to push
and pull and clone the respository.
create trust relationship between your git client and github.
After you created the github account, you
need to add your public key to the github key store.
You need to run the below command as any
linux account.
ssh-keygen -t rsa -C “youremail@example.com”
it will then create an .ssh under your home
directory. Please don’t change the permission of the directory and files in it.
Then go to you github account and choose “edit
your profiles” -> SSH Keys -> Add SSH key
Then choose a title and put your public key
(the content of id_rsa.pub) then save it.
create the remote repository
click the ‘+’ near your account
and give a sound name and discription and
probablly choose license type of your repository.
That’s it. Very easy.
link the remote repository with local repository
although usually we will create the remote
repository then clone it to the local respository. Sometimes we do it reverse.
Run the below command in your local
repository
this will link your local repository with
the repository called origin (the traditional repository name)
then you can push the content from your
local repository to remote repository.
it will create the master branch and linked
it with your local branch.
Then any modification in your local
repository, you can easily push it by
clone the existing repository.
If you have already got a remote repository
and want to clone it to the local repository,
There is an easy command:
You can create an empty directory in your
Linux box and run:
git clone git@github.com:aaaaatoz/learngit.git
then it will download all the repository
stuff to your local box and you can control it easily.
After you modify the content locally you
can push it back to github repository by git push origin master
No comments:
Post a Comment