问题描述:

I need to take a lot of file from an existing website and put them into a git repository. What is the best way to add these files into an existing git repository from my ftp?

网友答案:

One way is to locally save all the files you want to use from the FTP server, into a new_project directory. Then:

  • Create a new repository in GitHub called for example, new_project. Assuming the clone URL of the project is: https://github.com/user/new_project.git

  • Execute the following commands in your Terminal:

    cd new_project
    git init
    git remote add origin https://github.com/user/new_project.git
    

Add the files in the repository.

  • Stage the file for the first commit to your repository:

    git add .
    
  • Commit the files that you've staged in your local repository:

    git ci -m "Initial commit"
    
  • Push the changes in your local repository to GitHub.

    git push origin master
    
相关阅读:
Top