远程网站,目录/home/fl/www,现在转为git取代FTP上传代码。
但 /home/fl/www 里面已经有代码了,且也没有git init 过。
运行代码 cd /home/fl
再 git clone git@bitbucket.org/xxxx.git www
,报错提示 fatal: destination path 'www' already exists and is not an empty directory.
如何才可以将 git 中的复制到 /home/fl/www ,覆盖掉
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
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
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.