SCP File from local to Heroku Server

拈花ヽ惹草 提交于 2019-12-03 15:54:36

问题


I'd like to copy my config.yml file from my local django app directory to my heroku server, but I'm not sure how to get the user@host.com format for heroku.

I've tried running 'heroku run bash'

scp  /home/user/app/config.yml

I'm not sure how I can get it in the

scp user@myhost.com:/home/user/dir1/file.txt user@myhost.com:/home/user/dir2' 

format


回答1:


As @tamas7 said it's firewalled, but your local machine is probably also firewalled. So unless you have a private server with SSH accessible from the Internet, you won't be able to scp.

I'm personally using transfer.sh free and open source service.

Upload your config.yml to it:

$ curl --upload-file ./config.yml https://transfer.sh/
https://transfer.sh/66nb8/config.yml

Then download it back from wherever you want:

$ wget https://transfer.sh/66nb8/config.yml



回答2:


According to http://www.evans.io/posts/heroku-survival-guide/ incoming connections are firewalled off. In this case you need to approach your local machine from the Heroku server.

heroku run bash
scp user@mylocalmachine:/home/user/dir/file.txt .



回答3:


This is a bit late to answer this question, but I use services like localtunnel - https://localtunnel.github.io/www/ to copy files from local machine to heroku.

First, run a python HTTP server in the directory where the file is located.

cd /path/to/file
python3 -m http.server

This starts a server in port 8000. Configure localtunnel to connect to that port.

lt -s mylocal -p 8000

Now from your heroku machine, you can fetch the file via curl.

curl -XGET http://mylocal.localtunnel.me/myfile.txt > myfile.txt


来源:https://stackoverflow.com/questions/27761986/scp-file-from-local-to-heroku-server

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!