How do i use github to store your repository?
-
git man page: http://bit.ly/2nvGNWB
Link: https://github.comSome pre-reqs are generate a ssh key for your own user using ssh-keygen
Github stores your git repositories remotely, it's like a backup of you local repo, on a remote system for save keeping, but with specialised features built around it for collaborating on projects.
It's free for public accounts and you can have many projects as you wish for public, to create private repositories you have to purchase a subscription.
After using the Github interface for some time you will quickly become familiar with it.
Signup to Github, on the top right corner there's a drop down for your user, under there, you will see the settings, click setting, and on the left there a section for SSH Keys, add your ssh public key to this.
After the above in the very top right you will see a + with a dropdown, click the drop down and choose Create a repository
Choose a repository name, leave it as public and click Create Repository
For a totally new repository do this from your local computer.
$ echo "# mygitrepo" >> README.md $ git init $ git add README.md $ git commit -m "first commit" $ git remote add origin [email protected]:testbeetroot54/mygitrepo.git $ git push -u origin master
For an existing repository:
$ git remote add origin [email protected]:testbeetroot54/mygitrepo.git
Check to see the remote has been added to your local computer
$ git remote -v origin [email protected]:testbeetroot54/mygitrepo.git (fetch) origin [email protected]:testbeetroot54/mygitrepo.git (push)
Push up the repository to gihub, so you're pushing to origin (github) from your local master repository.
$ git push origin master Enter passphrase for key '/home/testbeetroot54/.ssh/id_rsa': Counting objects: 34, done. Delta compression using up to 4 threads. Compressing objects: 100% (24/24), done. Writing objects: 100% (34/34), 3.14 KiB | 0 bytes/s, done. Total 34 (delta 8), reused 0 (delta 0) remote: Resolving deltas: 100% (8/8), done. To [email protected]:testacct808/mygitrepo.git * [new branch] master -> master
As you can see there was a an added layer of security entering SSH passphrase, but after that it pushed out repository to github. The push can also ask for your github user and password if you used HTTPS.
© Lightnetics 2024