[Git] csdn's use of the Code platform

Source: Internet
Author: User

Simply say Git's use ....

Code and hosting platform Csdn just got out of the code.csdn.net.
[Chinese interface What's simple point, good understanding, well, easy to use ...]

Git uses the latest version: git-1.8.4-preview20130916
http://pan.baidu.com/share/link?shareid=4006639853&uk=1427042506


The task is to submit the mess project to the server.

Open Code.csdn.net Create a new project

Now configure the Git tool

After installation, find this stuff.

Open it

Okay, now configure Git's global account first.

git config--global user.name "CSDN id"
CSDN ID is after login, go to [url]passport.csdn.net, at the bottom of "personal account" to view the user name
See Jiangzi,

So what I'm writing on the command line is

Configure the Mailbox
git config--global user.email "CSDN Passport registered mailbox"
"" Sign directly to register CSDN that email address is OK


Forgotten can be on the [URL]passport.csdn.net modify the modified mailbox to see

Add SSH Public key
You're just going to use it to encrypt and transfer something .... Don't explain
Enter the CD ~/.ssh in the Git window
If you are prompted no such file or directory/no files or directories
Instructions for the first time, Sir, into the public key
$ mkdir Key_backup
$ CP id_rsa* Key_backup
$ RM id_rsa*
Just type in the few.
Note that the $ number does not have to fight,,,,,
1. Create a key_backup directory
2. Back up key (if any)
3. Delete the original key


Important come on, enter:
Ssh-keygen-t rsa-c "Your e-mail address"
Generate a new key


You will be prompted to enter a password after the return, this password will be used when you submit the project, if it is empty, you do not have to enter the project. [PS: Or add a password bar,,, equivalent to some software startup password]


is important.
Login to the Code platform, enter the user "account Settings", click on the right side of the column "SSH Public Key Management", click "Add Public Key", the public key just generated to fill in the "Public Key" column, and give it a name, save it.




Generated public key in this, directly select Copy the Open Text to that box on the line


Note: Do not copy extra spaces when copying the public key, otherwise the addition may not succeed.

Fill it out like this.

Start submitting the project to the code server ....


Again, my project is in D:\MyEclipse\MESS.
And that's it.

[Upload Item]




Initialize the project with git init first
Then use git add to add the files you want to upload,
git Add. Note the decimal. This means that all files under the current directory are added,
You can also add a file or a group of files
Such as:
git add index.jsp
git add Hello.java hello.class
This adds the file to be uploaded [PS: Not yet uploaded, just equivalent to the tag]

Git commit-m "First commit"

This command git commit is to prompt git to commit the code, [PS: Tell Git project modified,,, to upload the file also added]
-M means to add comments//So to speak ...
"First Commit" is the information you want to tell someone about this submission, such as: what was submitted


Now, to do something very important,
Where is the project to be submitted to? Now there's only one item on code,
What if I created a bunch of projects?
How to submit?




Look at the interface where you just created the project, there's a project address,
All to add in git, the command is:
Git remote add origin < Project URL, such as [email protected]:xxx/xxx.git>


Origin is a name, take one yourself,,,
followed by the project is at the site,,,,
So that's what I do:


[PS: Found useless git init initialization project after the path hint more than a master (branch name)]


No error message after carriage return is OK.

Now the last step to uploading the project .....
Finally, the project can be submitted to the server.


To run the command:
Git push-u Origin Master


The name of the Origin project, which can be changed, is not necessarily the same as the local folder (project) name
Master Branch, now remember the line, master on behalf of the main branch,,,,, do not understand the GIT manual


What I'm running is:






Enter, last input, above I said the start password of the east
Enter







What is this, a mistake?
All right..... To be honest,,,,,,, in fact ..... There's an error in the previous step.

This error will occur if you do not know that the server project has been modified ... (PS: Although you haven't uploaded anything yet, you forgot a setting when you created the project ...)




You have already initialized the project on the server when you created the project,,,,
And then initialize it locally.
(The initialization information is saved in the Readme.md file, which can be seen in the root directory of the project)
The equivalent of initializing two times, and then initializing the result is not the same,,,,,,, the conflict ....


Workaround,,, force synchronization? I wonder if that's the way it is.
git push--force MESS
Mess is the project name .... (For the time being, so to understand ...)
Add a--force note is a two minus ...
Enter password after entering (the startup password mentioned above)
Will upload the project, you can also see the progress of the upload ....




Upload successful




Force push code to the server this is still less.
In case the accident is not good ... [PS: Not afraid, can also roll back the transaction
(PS: Well, casually speaking, that stuff doesn't seem to be called business)]


If it's the first time there's no problem,,,,,,,,





Refresh the page of the item on the code platform, go to Code view, discover that the project has been uploaded successfully ....

[Git] csdn's use of the Code platform

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.