如何将Git版本控制

如何将Git版本控制

本文介绍了如何将Git版本控制(Bitbucket)添加到现有的源代码文件夹?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将现有文件夹的内容添加到Git版本控制中?

教程


  • 打开Git CMD控制台并从第二张图片输入命令1(转到您的项目折叠呃在你的电脑上)


  • 输入命令 git init


  • 键入命令 git add --all


  • 第二张图片( git remote add origin YOUR_LINK_TO_REPO

  • -mmy first commit


  • 输入命令 git push -u origin master


  • $ b :

      git config --global user.emailyourEmail#your email at Bitbucket 
    git config --global user.nameyourName#你在Bitbucket的名字


    How can I add the contents of an existing folder to Git version control?

    The tutorial here covers the case of making a directory and then adding source contents to it. I have some source code in a folder that is path dependent and don't want to move it.

    So, how can I just go into my folder and make it a repository?

    解决方案

    Final working solutionusing @Arrigo response and @Samitha Chathuranga comment, I'll put all together to build a full response for this question:

    1. Suppose you have your project folder on PC;
    2. Create a new repository on bitbucket:

    3. Press on I have an existing project:

    4. Open Git CMD console and type command 1 from second picture(go to your project folder on your PC)

    5. Type command git init

    6. Type command git add --all

    7. Type command 2 from second picture (git remote add origin YOUR_LINK_TO_REPO)

    8. Type command git commit -m "my first commit"

    9. Type command git push -u origin master

    Note: if you get error unable to detect email or name, just type following commands after 5th step:

     git config --global user.email "yourEmail"  #your email at Bitbucket
     git config --global user.name "yourName"  #your name at Bitbucket
    

    这篇关于如何将Git版本控制(Bitbucket)添加到现有的源代码文件夹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

    07-23 14:23