Mac OS X command line submit local project to git

Source: Internet
Author: User

Mac OS X command line submit local project to git
In the past, git was used on the GUI. Today, we have the opportunity to perform a practical operation on the text interface. I recorded the process for anyone who needs it. Note: The starting position of $ is a command line ($ does not belong to a command), and no result is output. 1. Before using the git command tool, make sure that you have installed the git command tool. If git is installed in your system, enter the git command on the terminal to view the relevant information. 1 $ git -- version2 git version 2.4.9 (Apple Git-60) 2. If not, you can install Xcode Command Line Tools, just install the necessary Command Line, the package is not large. (Its built-in git environment) 1 $ xcode-select -- install 3. create a remote git Project (I believe everyone will, skip this step) 4. I copied the previous git project as a new local project and submitted it to a new git Project (you can create a local project) the purpose here is to introduce git initialization. After a project becomes a git project, a hidden. git file contains git information. When you copy a git project and submit it as a new project, you must delete the. git hidden file in the project. Otherwise, the git Information contained in your project is still in the previous project, and will be submitted to the previous project. A. switch to the directory of the project you want to submit on the terminal (please switch to the actual directory location of your project) 1 $ cd/Users/my_mac/Documents/workspace/copy-project B. view All files in the directory (including hidden files) 1 My-MacdeMacBook-Pro: copy-project my_mac $ ls-a2 .. git. settings pom. xml3... gitignore assembly. xml src4. classpath. project doc target c. delete. git directory 1 $ rm-fr. git 1 My-MacdeMacBook-Pro: copy-project my_mac $ ls-a2 .. gitignore assembly. xml src3... project doc target4. classpath. settin The gs pom. xml file has been deleted successfully. Now you can submit the file. (If a new project is created, the c operation does not exist.) 5. submit the project to git and execute the following commands in the current project directory:. git initialization, create an empty Git repository 1 $ git init B. add the current directory and all subdirectories and files 1 $ git add. c. submit to local repository 1 $ git commit-m "new project" d. push to remote repository (http protocol is used, and your own url is entered) 1 $ git remote add origin http://XXXXXXX.git 1 $ git push-u origin master during the above operation, if it is the first time, you may also need to enter your git user name and password to verify git permissions. If permission denied is encountered during statement execution, add sudo to the command. 6. git clone your git project has been successfully created. If you download a remote git project through eclipse, a git directory will be created under your root directory by default, and the project will be put in this directory. You can also execute this operation through the command line. 1. Create the git directory 1 $ cd ~ in the root directory ~ 1 $ mkdir git2 $ cd git 1 $ git clone http: // XXXXXXXXX. git2. then you can import the git project locally in eclipse. If a friend is not familiar with the above commands. You can enter the command you want to query on the terminal, for example, input man mkdir to print the usage and parameters of mkdir. The git official website provides more detailed git operation commands. You can view the learning information on your own. 7. done

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.