美文网首页
Git 初始化Repository操作

Git 初始化Repository操作

作者: Thresh0ld | 来源:发表于2016-07-26 09:48 被阅读180次

    Command line instructions

    Git global setup

    git config --global user.name "UserName"
    git config --global user.email "1234567890@qq.com"
    

    Create a new repository

    git clone http://gitlab.ddns.net/DrivingExam/DrivingExamApi.git
    cd DrivingExamApi
    touch README.md
    git add README.md
    git commit -m "add README"
    git push -u origin master
    

    Existing folder or Git repository

    cd existing_folder
    git init
    git remote add orign http://gitlab.ddns.net/DrivingExam/DrivingExamApi.git
    git add .
    git commit
    git push -u origin master
    

    注意:如果项目是用在XCode上的,建议在GitHub上创建项目时不要勾选创建ReadMe.md和.gitignore 不然的话在XCode上无法初始化推送。

    CreateNewRepository.png XCodeSourceControl.png AddRemote.png

    当然,如果你嫌麻烦,完全可以按照下面的Git命令来操作。
    以下是在GitHub上新建一个项目后GitHub提供的提示信息:

    Quick setup — if you’ve done this kind of thing before
    Set up in Desktop
    or

    HTTPS: https://github.com/wind0ws/HelloSwift.git

    SSH: <git@github.com:wind0ws/HelloSwift.git>

    We recommend every repository include a README, LICENSE, and .gitignore.

    …or create a new repository on the command line

    echo "# HelloSwift" >> README.md
    git init
    git add README.md
    git commit -m "first commit"
    git remote add origin https://github.com/wind0ws/HelloSwift.git
    git push -u origin master
    

    …or push an existing repository from the command line

    git remote add origin https://github.com/wind0ws/HelloSwift.git
    git push -u origin master
    

    …or import code from another repository
    You can initialize this repository with code from a Subversion, Mercurial, or TFS project.
    Import code


    关注我的公众号.jpg

    相关文章

      网友评论

          本文标题:Git 初始化Repository操作

          本文链接:https://www.haomeiwen.com/subject/wfsnjttx.html