The previous article mainly introduces the basic principles of Git, common commands, using a folder to create a shared repository. But in most cases, developers usually host the code to a third-party git server, which means we build the shared repository on someone else's git server. This eliminates the tedious process of building git servers, and third-party institutions like GitHub and Oschina are relatively secure, and we can do it boldly. Of course, a big company like bat must have its own git server. Here I will be for the company's Daily development of common third-party hosting agencies, this article mainly describes how to host the code on GitHub and Oschina.
Create a code warehouse on GitHub
1. Visit the GitHub website (https://github.com)
2. Enter your GitHub account number and password (you must register before you have registered your account)
3. After entering the GitHub home page, click on the "+" icon to the left of the top right corner and select "New repository". Such as:
4. Give the code repository a name. Add a description (optional). Select Public (if you choose to pay for private). Choose whether to add a Readme file (the Readme file is the documentation for the project, which we can explain in the readme.) Add the. gitignore file (what language of the project will be selected, I am here to develop iOS projects as an example, so the choice is objective-c). Add a license, in general, if you choose public then Apache License 2.0 is selected here. Finally, click "Create Repository" to build the warehouse. Such as:
5. For example, create a good code warehouse
GitHub Identity Verification
We've built a warehouse on GitHub above. The next step is to download the code repository locally, then initialize the project and push to GitHub's remote repository.
For the push code to the remote repository, GitHub provides two ways of securing authentication, HTTPS and SSH, respectively. Here we first introduce HTTPS, and then we introduce SSH.
Verifying identities by means of HTTPS
1. Select HTTPS and copy the link address. Such as:
2. Open Xcode and click on the upper left corner xcode->preferences (or use the shortcut key directly: Command + ","). Address is the connection to the warehouse on GitHub. Enter the user name and password on GitHub and click Add. Such as:
3. Click Xcode's source Control->check out. Select the remote repository on GitHub and click "Next". Such as:
4. Select a directory to save the files and directories copied from the GitHub repository and click "Download". Such as:
5. At this point, you can create a new project in the same directory that you just copied.
Note: The following create Git repository on is not allowed to be checked when we choose to put the project into the local repository. Such as:
6. When the project is created, all files will become "a" status, representing the current code is stored in the suspended area. Such as:
7. As with SVN, click on Source Control->commit, enter a comment, click Commit to submit the file to the branch of the deferred zone. Such as:
Note: If we tick "push to remote" in the lower-left corner, the code will be push to the GitHub remote repository immediately after it is submitted to the point. It is recommended that you do not check if there is no network or network bad (the author does not check push to remote in the example).
8. If "Push to remote" is not checked, then you need to click on source Control->push, click Push, and push the local code repository file to the GitHub remote repository. Such as:
9. At this point, we can see the project just push on GitHub. Such as:
At this point the HTTPS method of verification and detailed procedures have been introduced, if there is a problem, please comment, welcome to correct me.
Due to the length of the SSH method verification please move to the next article: http://www.cnblogs.com/wsnb/p/5104268.html
PS: The article for the author's original, follow-up I will share more practical technology, welcome attention. If you think this article is helpful to you, please specify the source of the reprint.
To host the code to the GitHub server for HTTPS authentication