search

Home  >  Q&A  >  body text

版本控制 - git 如何取代FTP 部署,fatal: destination path 'www' already exists

远程网站,目录/home/fl/www,现在转为git取代FTP上传代码。
但 /home/fl/www 里面已经有代码了,且也没有git init 过。
运行代码 cd /home/flgit clone git@bitbucket.org/xxxx.git www,报错提示 fatal: destination path 'www' already exists and is not an empty directory.

如何才可以将 git 中的复制到 /home/fl/www ,覆盖掉

曾经蜡笔没有小新曾经蜡笔没有小新2792 days ago1039

reply all(3)I'll reply

  • 我想大声告诉你

    我想大声告诉你2017-05-02 09:20:13

    The most direct reason why Git replaced ftp should be its version control capability. This is a good mechanism, but using Git to deploy code is not like you have to manually pull it down on the server every time. Configure it in the correct way. Finally, you can automatically push the code to the online server after you upload it to the code base, thereby always ensuring that the code version of the server is consistent with that of your code base.
    In fact, the key to this configuration is to sort out the relationship between local-code library-online service code, ssh automatic login and hook (hook) configuration of the code library. The first one has been mentioned above, ssh and hook Please configure the configuration and other related content here

    reply
    0
  • 某草草

    某草草2017-05-02 09:20:13

    First clone to the www_new folder, then name Www to www_old, and finally rename www_new to www. It’s up to you whether to delete www_old or not

    reply
    0
  • 黄舟

    黄舟2017-05-02 09:20:13

    An error message indicates that your target path folder already exists.
    So just go to the root directory of your website to initialize the new warehouse, and then pull the code over.

    1. cd 到你的网站根目录;
    2. git init //初始化新仓库
    3. git remote add [<repository>] //添加远端git仓库
    4. git pull deploy //拉取你的git仓库的deploy部署分支

    reply
    0
  • Cancelreply