|
Recent love Web programming, so look for a variety of code, and then discovered the GitHub site, if you know that Google Code, then you know what this is doing a GitHub. But GitHub is used mainly for Git distributed version-based library management system, you can save and manage their own code, and is mainly used to develop the code. But for me, Git control system is also more difficult to grasp, or the development of small systems is not yet need it, so I put GitHub as share and display tags.
After registration you will have GitHub 0.3G free space, but can only create a public project, which also meet the code sharing purpose of my favorite touches its code to show the way, you can browse the code, the code is the result of high bright, add line numbers treated, very beautiful, first-class experience, such as this Webpy hosting place. As people want to know your code, you can choose to directly browse online're interested, you can also directly download the archive, or directly to a local Git clone.
Because GitHub is based on the Git version control system, so you can modify the code to upload something, you need to use the Git tools. I have here is mainly used to share and display code, so do not want to elaborate too much in version control, the following briefly explain how to create a new project on GitHub, as well as his own code passed up. Below the premise that you have registered GitHub and download and install Git - Git download, Windows version download.
Upload Share Code
1. Establish project on GitHub
After logging in GitHub, where you can find a button on the right by the "New Repository", after click, fill in the project name, description, and after the site can create, and then there will be a prompt page, note the similar git @ github. com: XXX / XXX.git address, this is the address you this project.
2. Configure Git, and upload the code
After you install Git is successful, if it is under Windows, choose Git Bash, do everything, may start a little trouble on the command line, but it was a few command line, with a few friends to remember. First, initial settings Git:
1 git config --global user.name "Your Real Name"
2 git config --global user.email you@email.address
And then make the most troublesome step, you need to upload files to the Git GitHub's system, may need an SSH key authentication, the following began to generate a key and submit key. Open Git Bash, create SSH key:
1 ssh-keygen -C 'your@email.address' -t rsa
Then you enter the SSH key to the storage location, you can not care, directly enter the default path. Then enter the password you want, SSH key is generated. Now you will need to submit the Key to GitHub, first open the Key to save the position, there will be three files, find id_rsa.pub, open with a text editor, copy all the characters inside. To GitHub, found in the upper right toolbar Account Settings. On this page there is a SSH Public Keys tab, select Add another public key. You can easily fill a Title, Key to paste the characters submitted.
After completing these tasks, you can upload your own code. Find their upload code to share a folder, right click and select Git Bash, or enter this folder in the Git Bash. The establishment of a warehouse:
1 git init
Select the files you want to add into the warehouse:
1 git add.
Usually if you want to share all the code in this folder, and then add in the back plus ".", The above example is such that if the specified pass, simply put. "" Change the file name, and now just chose to add a file repository, the following is added into the warehouse:
1 git commit -m 'Test'
-m Back with an argument, an explanatory, the tags are submitted to GitHub, the code will be displayed on the file information display shows the following figure marked places.
Out for so long, only now beginning to be uploaded to the local repository GitHub, and the following two commands to get the problem:
1
2 git remote add origin git@github.com: XXX / XXX.git
3 git push -u origin master
This git@github.com: XXX / XXX.git is created above the project is to generate address. Now open your project site, you can find that your code has been demonstrated out. If you want to update the code, just repeat the above it.
If you submit sensitive information, such as the code set their own password forgot what to delete uploaded go up how to do? After revising upload still history, delete history using Git looks like a lot of trouble, so they use it to delete items, delete and re-upload. Remove the top right of the desired item is found on GitHub site admin button, go to the right at the bottom there is a delete button, so that you can delete.
This article does not cover Git and sharing features such as code development, because it is only to those who, like me, being only share code reference, if you want to learn more about Git and GitHub usage |
|
|
|