We can't replace connection when the script is has lock on it.
...
We can't set connection for an app to a cloud environment when login to an on premise environment.
We can not Check -in File From Cloud to On-premise and Publish it.
If We add a Private Sheet/Story and Then Publish it to Any Destination on cloud, It wont be published to cloud but if we modify existing private Sheet / Story, the changes will not appear on cloud.