Coding Quick Start for code management (GO)

Source: Internet
Author: User

When the project is created, how do we upload the code to coding? The Coding website uses "Git repositories" (like GitHub) to manage code. It works by using the Git service to sync files from the local project directory to the coding git repository

This article mainly contains the following content:

    • Command line upload Code
    • Graphical interface Upload Code
    • Problems

Note: The following demonstrations are performed on the WINDOWS8 system

When you create a project, you do not select the three options "enable README.MD file Initialization project", "Open Source License" and "Gitignore file" (We do not recommend this, of course). Click the "Code" option, you will see the following code management interface: you will see the Code access URL (shown in red box, HTTPS mode), that is, git address (do not use the browser to access OH). You can then create the project's "Git repository" by entering code in Windows CMD based on it.

1. Command line upload code to install git

Download git from the Git website (http://git-scm.com/downloads) and install it to drive C. Then add the bin in the Git directory (such as C:\Program Files (x86) \git\bin) to the PATH environment variable 。 Right-click Thispc > Properties > adavanced System Settings > Environment Variables Select PATH and click Edit (as shown in the red box). Add the path to the bin (C:\Program Files (x86) \git\bin) to the variable value and you can use the Git command in CMD.

Create a new project upload
//进入项目父目录mkdir gitDemo  //创建项目目录 gitDemocd gitDemo   //进入项目目录git init  //初始化空的 git 仓库touch README.md   git add README.md //这两行添加简单的 README.md 文件git commit -m "first commit" //提交时附加的信息git remote add origin https://git.coding.net/codingTutorial/gitDemo.git //添加一个名为 origin 的远端( url 为 git 地址)git push -u origin master //将该目录下的文件推送到远端(origin)上的 "master" 分支

Perhaps you will encounter the following problems: This is because you do not configure your user name and mailbox, you can enter the CMD in the Red Box command. Then enter your user name and password (as shown in the red box). Username is the character suffix or mailbox when login conding, password is also the password at login.

Upload an existing project or an updated item
//进入已有项目或更新的项目目录//若该项目目录未建立 git 仓库,则需用 READM.md 初始化 git 仓库,详见“创建新项目上传”//若有git仓库则直接添加远端仓库上传//如果目录下有文件没有被追踪(未与远端仓库同步),可以使用“ git add 文件名” 和 “ git commit -m "message" ”,来添加追踪文件git remote add origin https://git.coding.net/codingTutorial/gitDemo.gitgit push -u origin master //这两行将该目录下的文件推送到远端(origin)上的 "master" 分支

Similarly, for subsequent updates of the commit can also be in this way, that is, into the project directory, configure the remote, push code.

2. Graphical interface upload code to install the necessary software
    1. Download Msysgit (not required if installed) and install (http://msysgit.github.io/): The default point is to install.

    2. Installation Tortoisegit 64-bit: http://www.onlinedown.net/softdown/101592_2.htm 32-bit: http://www.onlinedown.net/soft/101591.htm Similarly, the installation is the default point in the end.

Configuring, using Tortoisegit

1. Build the Repository

Right-click on any empty folder and select "Git here to create repository"

2. Pull the Git repository's code to a local directory

Select the project folder right click and select "Pull"

Manage Remote: Click label in the Red box

Just configure the remote (remote) name (such as Origin) and URL (git address) to

After configuring the remote, click "OK". If the project is public, you do not need to enter a username and password. If you are a private item, you will need to enter your user name and password. User name is login conding when the personality suffix or mailbox, password is also login password

Or you can use the Clone command directly. Create a new empty folder and right-click Clone. Select the local folder path and the URL of the remote repository

Note: If the remote directory is empty, there is no master branch. You cannot use the pull command. You should use clone

3. Submit the Local Code Select project folder right click, select "Push" and select the far end (as shown in the red box, origin), click "OK". Enter the user name and password, and the code can be pushed to the far end.

Add documents under Project directory

If you create a new file in the project directory, the file must be "commit" or the push operation may fail. For example, add a file named "AddFile.txt" with the following steps: Select "Add" by right-clicking on the file. As shown in the red box.

Click Commit directly, or close the window and right-click the file. Select "Git commit->" Master ""

Enter a message, modify the version of additional information such as ("Add a File" AddFile.txt "), click OK, enter the user name and password. User name is login conding when the personality suffix or mailbox, password is also login password

Note: After you delete the files in the directory, you also need to right-click the project folder commit, otherwise you will not succeed push! 3. Common errors

When uploading the code, you may encounter the following error: This is because the version of the local code submitted is lower than the coding "git repository", so you have to first pull the "Git repository" to local, so that the local code version can be higher than the "Git repository". can be successfully push.

The above is just a brief introduction, about Git specific principles and operations, see: Pro Git:http://git-scm.com/book/zh

Git Learning resources:

Git Easy guide: http://www.bootcss.com/p/git-guide/

Git uses a detailed introduction to http://blog.csdn.net/gemmem/article/details/7290125

How do I use GitHub? http://www.zhihu.com/question/20070065

Git usage guide https://sites.google.com/a/kingofat.com/wiki/git-tutorial

Sublime Text2, Git, GitHub Synergy: http://www.zuojj.com/archives/1051.html

Using the Git plugin in sublime Text 2 to connect to GitHub http://www.cnblogs.com/owenChen/archive/2012/12/28/2837450.html

Coding Quick Start for code management (GO)

Related Article

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.