Before the installation of Git, with the upgrade of the system soon, found and forget the steps, although there are many tutorials on the web, but the search needs to waste too much time, because the GitHub connection is relatively slow, so the use of open source China's managed http://git.oschina.net/, The installation process is written in OneNote.
1. First need to install Git<a href= "http://git-scm.com/download/" >git official website </a>, and then git GUI and git Bash after installation, use the command line ~ ~
Open git Bash, under Simple configuration:
Create a directory to store your project, mkdir git, define it yourself
User name: # #这个名字会出现在你的提交记录中,
git config--global user.name "your name"
Email: # #这个email同样会出现在你的提交记录中, try to keep this email consistent with your [email protected] registered Email
git config--global user.email "blusou*** @xx. com"
2. Configured, to connect with the remote, SSH key can let your computer and [email protected] to establish a secure encrypted connection, you can follow the following command to generate Sshkey
Ssh-keygen-t rsa-c "Your Mailbox"
Then all the way blank enter can, (or do not change, I changed the name, the fourth step to add the public key after the password, the public key has not been added successfully, the specific reasons do not know, hand cheap ~ ~) and then you will be in the. SSH directory to see two files
3. Then view Sshkey, add it to the [email protected] Website profile-public key, view. SSH Directory
Cat ~/.ssh/git.pub # # (i renamed git here)
Right-click on the copy of the code, if not copy, right-clicking on the menu bar-----------Select quick Edit mode, you can copy to [email protected] The personal profile of your personal account to add a public key.
4. Add the public key after the terminal input
ssh-t [email protected]
If you return Welcome to [email protected], your name! Indicates that the add succeeds
5.clone you [email protected] project to local, project code in the upper right corner of HTTPS, enter [email protected] account password, (password is not visible, do not think there is a problem). Then you'll find your remote directory in the directory you created.
git clone https://git.oschina.net/blusoul/fend.git
6. Next, you can modify the local file, git operation requires the current directory has a. Git initialization folder, if you create a new project locally, you need to initialize the
Git init # #当前文件夹下回出现一个隐藏的. Git folder
Before the clone from the remote, I went to the next level of the directory, when you modify a file, you can view the status of the current changes in bash
Git status # #查看当前修改的状态, those files have been modified
Git add modified file path # #添加你修改的文件到缓存区
Git add-a # #添加所有的文件到缓存区
git add * # #通配符也可以
And then you can submit it,
git commit-am ' Test ' # #提交到本地库, followed by a modified description of the string
7. Uploading to the server
git Push https://git.oschina.net/blusoul/fend.git # #后面服务器上项目的地址
If you edit the file online, you will receive the following prompt, conflict with the server code, need to update to the local re-upload, you need to back up your changed files, update and re-modify, and then upload, so every time you modify to synchronize with the server resources.
Git Pull # #更新到本地
And then add it again, commit ...
OK, you can now see your locally submitted page on [email protected].
Note: Some summary of personal use, do not look at official documents, some of the terms are not accurate, the command is not detailed enough. ~~
Official website: https://git.oschina.net/oschina/git-osc/wikis/Home
git notes [email protected]