Today finally learned git, although not fully understand the git and svn differences, but also have mastered some of the basic git operation, read several tutorials, and finally will!!!
Previously thought Git is GitHub, really too naive too simple ....
Step into the chase:
The first step is to create a new project on GitHub and choose new Repository
The second step is to configure Git to upload the code to the local repository.
First, configure the user name and email
git config--global"Your Real Name" --global User.email " Your Email "
At first not very understand why to set these two things, later brother Said, User.Name represents the author's name, User.email equivalent to the login name.
Then, the SSH private key and the public key are created, because the SSH key is used to authenticate GitHub when it submits the code.
' [email protected] ' -t RSA
The following screen will appear
This refers to where the Sshkey is placed, the direct carriage return, will be saved to the path inside the parentheses, you can also enter a different path.
Then enter the password, enter the password two times. Note: The password entered does not show the number of digits
And then there was this picture.
Then find the location where the key is saved
Open the Id_rsa.pub file with a text editor and copy all of the contents.
To GitHub, choose settings
Take a title and paste the content you just copied into the key and submit it.
Once you have completed the above work, you are ready to submit your code. Find the code you want to share, and go to the folder directory in Git base.
Use the following code to create a warehouse.
Git init
At this time found a directory under the more than one. Git folder
Select the files you want to add to the warehouse, using the following code
git Add.
Add is followed by the. Instructions to submit all the files in the folder, if you want to submit the specified file, the "." Change to a file name, enclosed in single quotation marks, and be careful to add the extension.
The above step only select the file to be added to the warehouse, the actual submission of the file will use the following.
' Test '
The sentence after-m represents the submitted message. After committing the code to GitHub, the description is displayed on the code file information.
The above steps are just a matter of submitting the code to the local repository.
The third step is to upload the code to the remote repository, which is GitHub.
git remote add origin [email protected]:xxx/xxx.git
The following [email protected]:xxx/xxx.git is the SSH URL generated on GitHub
If you want to modify, you can open the config file inside the. git file for modification.
Next you can submit the code to the remote repository!!
This time I found that the GitHub project is more than I submitted code!!
Git learning-using the git base command line to build a remote repository on GitHub