In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
It may not be reproduced without the permission of the blogger.
Catalogue
Chapter 1 uploads the source code to GitHub 1
1.1 git Windows client 1
1.2 sign up for a GitHub account 2
1.3 Login 2
1.4 create a native code repository 2
1.5 create a remote code repository 3
1.6 Line Terminator 5
1.7 submit changes to local code repository 7
1.8 synchronous code repository 7
1.9 add files to the local code repository 8
1.10 remove native code repository 9
1.11 add native code repository 9
1.12 remove remote code repository 10
Chapter 2 uploads the source code to oschina 11
2.1 create a remote code repository 11
2.2 SSH KEY 13
2.3 Clone the remote code repository to local 14
2.4 other operations 16
2.5 README.md 16
Chapter 1 upload the source code to GitHub
1.1 Git Windows client
There are many Windows client software with git function, such as git for windows (former msysGit), TortoiseGit, GitHub Desktop (former GitHub for Windows).
The author's understanding of these clients:
1 、 git for windows
Git is native to Linux and needs to be migrated to run on Windows. Git for windows is one such migration project. It transplants not only a program, but also simulates a linux environment on Windows.
The download address of git for windows is https://git-for-windows.github.io/, and the latest version is 2.10.2. It has two modes of operation: command line (used by experts) and graphical interface (used by rookies). However, its graphical interface is still troublesome to operate, so the author did not choose it.
Git for windows is an open source project, browse the downloadable source code of https://github.com/msysgit/msysgit.
2 、 TortoiseGit
TortoiseGit is just a graphical interface program, and it calls git for windows internally. Therefore, you need to install git for windows before using TortoiseGit.
The biggest advantage of TortoiseGit is that it is the same as the operation of TortoiseSVN, and users who are familiar with SVN can get started quickly.
3 、 GitHub Desktop
GitHub Desktop, like TortoiseGit, calls git for windows internally. However, the author believes that its operation is the simplest of the three software, and it can be used without configuration after installation, which is very suitable for rookies.
GitHub Desktop can be downloaded from https://desktop.github.com/. The downloaded file GitHubSetup.exe is an online installer and may not install properly. To do this, you can download the offline installation package at http://pan.baidu.com/s/1Hkewm. Download GitHub_3_0_5_2.zip, decompress it and run GitHub.application to install it.
Note: if the offline installer does not work, you need to install .NET Framework 4.5 first. You can first run the online installer GitHubSetup.exe to install .NET Framework 4.5. Then run the offline installer.
1.2 sign up for a GitHub account
To upload the open source code to GitHub.com, you need to register an account on the site. Please visit the website https://github.com/ and click the "Sign up" button to register your account. The operation is relatively simple, so I won't repeat it any more.
1.3 Login
After installing GitHub Desktop, you need to enter the user name and password of GitHub.com for the first run, as shown in the following figure:
Figure 1.1
In the image above, after entering the user name and password, click the "Log in" button to complete the login.
1.4 create a local code repository
Click the button "+" in the upper left corner of the GitHub Desktop main interface, and the following interface will be displayed:
Figure 1.2
Click the "Create" button, enter "Name" and "Local path", and then click the "Create repository" button to complete the creation of the local code repository.
As shown in the following figure, the essence of creating a local code repository is: 1) create a directory W:\ (yhf)\ git\ GitHub\ test;2) generate two files .gitattributes and .gitignore in this directory; 3) execute the git init command in this directory to generate a .git directory (the directory is a hidden directory).
Figure 1.3
1.5 create a remote code repository
This is shown in the following figure. In GitHub Desktop, first select the native code repository test created in the previous section, and then click the "Publish" button in the upper right corner.
Figure 1.4
The following interface is displayed
Figure 1.5
"Name" is the name of the remote code repository; "Description" is the description of the project. Clicking the "Publish test" button will complete the creation of the remote code repository and upload the contents of the local code repository to the remote code repository.
The remote code repository is on github.com, as shown in the following figure:
Figure 1.6
1.6 Line Terminator
When uploading files from the local code repository to the remote code repository, git is smart: it automatically replaces the Windows line Terminator\ r\ n (that is, 0DH, 0AH) with\ n. At this point, VC++.NET says it doesn't matter, VC++6.0 is hurt (.dsp and .dsw files cannot be parsed). To prevent git from automatically changing the line Terminator, you need to modify two files.
On Windows 7, modify the file C:\ Users\ Administrator\ .gitconfig (Administrator is the user name when you logged in to Windows). Add configuration items autocrlf and safecrlf. As follows:
Figure 1.7
Note:
1. The line Terminator of the file is\ n, which is 0AH. Therefore, the author uses UltraEdit to edit it instead of the notepad that comes with Windows.
2. The space before autocrlf and safecrlf is actually a TAB (09H) character
3. This file only needs to be modified once.
Modify the file .gitattributes in the local code repository and use notepad, as shown in the following figure:
Figure 1.8
In the figure above, delete the auto in text=auto and save it.
1.7 submit changes to the local code repository
In the previous section, you modified the file .gitattributes in the local code repository. This change should be submitted to the local code repository (which means modifying the files in the .git directory of the local code repository). The specific operations are as follows:
This is shown in the following figure. In GitHub Desktop, first select the code repository test, and then enter the "? uncommitted changes" page. After entering the submission information, click the "Commit to master" button.
Figure 1.9
When the prompt shown in the following figure appears under the main GitHub Desktop interface, the submission is complete.
Figure 1.10
1.8 synchronous code repository
The previous section submitted the changes to the local code repository. This change can be submitted to the remote code repository through the "synchronize" operation.
As shown in the following figure, click the "Sync" button in the upper right corner of the GitHub Desktop main interface.
Figure 1.11
1.9 add files to the local code repository
Copy the code file to the folder where the local code repository is located, as shown in the following figure:
Figure 1.12
Then submit these files to the remote code repository as described in sections 1.7 and 1.8.
1.10 remove the local code repository
Take the deletion of the local code repository test as an example. As shown in the following figure, right-click "test" and click the [Remove] menu item from the pop-up menu to remove test from the GitHub Desktop warehouse list.
Figure 1.13
The above deletion only removes test from the list of GitHub Desktop repositories, and the physical deletion of the local repository requires the deletion of the folder W:\ (yhf)\ git\ GitHub\ test shown in figure 1.3.
1.11 add native code repository
Test was removed from the list of GitHub Desktop repositories in the previous section, but the actual local repositories were not deleted. At this point, you can add local warehouses. As shown in the following figure:
Figure 1.14
After doing this, test will be added to GitHub Desktop's warehouse list.
1.12 remove remote code repository
Browse to the address of the remote code repository, such as https://github.com/hanford77/test, then go to the settings page and click the "Delete this repository" button.
Chapter 2 upload the source code to oschina
It is convenient for GitHub Desktop to manage the remote code repository on GitHub.com, but the operation will be different if you switch to other git servers. For example, GitHub Desktop cannot create a remote code repository on oschina. This chapter focuses on how to upload open source code to oschina.
2.1 create a remote code repository
Log in to the website http://git.oschina.NET and create a project after registering an account. The page displays as follows:
Figure 2.1
For the choice of open source license, please refer to the following figure (from the blog http://www.ruanyifeng.com/blog/2011/05/how_to_choose_free_software_licenses.html).
Figure 2.2
Click the create button in figure 2.1 to complete the project creation. As shown in the following figure:
Figure 2.3
Click "SSH" in the image above, and then click the copy button at the right end to copy the project's git@git.oschina.net:hanford/test.git to the clipboard.
Note: you can also click HTTPS and copy the https URL of the project. The trouble with this URL is that a user name and password are required when the local code repository is synchronized with the remote code repository.
2.2 SSH KEY
The previous section copied the SSH address of the project: git@git.oschina.Net:hanford/test.git. With SSH, authentication is also required when communicating with a remote computer (enter a user name and password). To simplify authentication, you can use SSH KEY.
Before using SSH KEY, it needs to be created. There is no need to use the git command line, GitHub Desktop has done all this for you. Enter C:\ Users\ Administrator\ .ssh (Administrator is the user name when logging in to Windows) as shown in the following figure:
Figure 2.4
Github_rsa and github_rsa.pub are the private and public keys needed when GitHub Desktop communicates with GitHub.com.
Id_rsa and id_rsa.pub are the private and public keys that GitHub Desktop needs to communicate with other git servers.
Notepad opens the id_rsa.pub copy public key, and pastes the public key into the oschina website, as follows:
Figure 2.5
The second item in the figure above is randomly filled in, and the third item is the public key. Click the OK button to finish adding a public key.
After the above configuration, GitHub Desktop will use the private key and public key when communicating with the oschina server, and you no longer need to enter a user name and password.
Note: why doesn't GitHub.com need to set up SSH KEY? Because GitHub Desktop has done the work automatically. (so, GitHub Desktop is really suitable for rookies)
2.3 Clone the remote code repository to the local
Click the [GitHub,Inc] [Git Shell] menu item under the Windows start menu, as follows:
Figure 2.6
The following command window is displayed
Figure 2.7
Enter the local code repository directory (W:\ (yhf)\ git\ oschina) and run the command
Git clone git@git.oschina.net:hanford/test.git
Note: git@git.oschina.net:hanford/test.git is the project address copied in figure 2.3.
After the command is executed, you can see the native code repository test under W:\ (yhf)\ git\ oschina. As shown in the following figure:
Figure 2.8
Using the method in Section 1.11, add this native code repository to the list of GitHub Desktop repositories. As shown in the following figure:
Figure 2.9
Note: the remote code repository of test is not on GitHub.com, so test is under Other.
2.4 other actions
For other operations, please refer to Section 1.6 (do not modify the file .gitattributes), Section 1.7, Section 1.8, Section 1.9.
2.5 README.md
When you create a remote code repository on oschina, the file README.md is created by default. It is a markup language file in Markdown format. It's a description of the whole project.
With regard to the format of .md files, it is important to note:
1. The line Terminator is\ n (0AH)
2. Encode UTF-8 without BOM
3. GitHub.com ignores the line Terminator.
For the use of Markdown markup language, please consult the relevant information on the Internet.
This article is from http://blog.csdn.net/hanford/article/details/53065310
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.