question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature proposal: sftp context by git branch

See original GitHub issue

Just a proposal, maybe you like it

Example config

[
  {
    "context-git-branch": "master",
    "remotePath": "/remote/public_html",
    (...) 
  },
  {
    "context-git-branch": "dev",
    "remotePath": "/remote/staging", 
    (...) 
  }
]

So when switching branches, the sftp context would change as well

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
ursbraemcommented, Jun 19, 2018

Thanks! I’m now using different config files, like this

.vscode/sftp-live.json
.vscode/sftp-dev.json
.vscode/sftp.json

And depending on the context I just paste the content of one of the first files into sftp.json (much more robust than renaming all the time)

So probably in the post-checkout-hook it would only need something like cp .vscode/sftp-{branchname} .vscode/sftp.json

0reactions
ursbraemcommented, Oct 8, 2019

Not depending on the git branch, but here’s a working example for SFTP with multiple profiles (on mac with pubkey, same server).

{
    "name": "multi profile",
    "protocol": "sftp",
    "host": "server.com",
    "port": 123,
    "privateKeyPath": "/Users/mac_username/.ssh/id_rsa",
    "uploadOnSave": true,
    "username": "hosting_username",
    "agent": "$SSH_AUTH_SOCK",
    "passphrase": true,
    "profiles": {
        "dev": {
            "name": "dev",
            "remotePath": "/path/to/dev/"
        },
        "live": {
            "name": "live",
            "remotePath": "/path/to/prod/"
        }
    },
    "defaultProfile": "live"
}

Switch with cmd+Shift+P `SFTP: Change profile`
Control at the bottom of vscode:

![image](https://user-images.githubusercontent.com/1446443/66384704-891e4b00-e9bf-11e9-8236-91c34d66f3dc.png)
Read more comments on GitHub >

github_iconTop Results From Across the Web

Feature branch workflow - GitLab Docs
Feature branch workflow. all tiers ; Clone project: git clone git@example.com:project-name.git ; Create branch with your feature: git checkout -b feature_name.
Read more >
Git - Branching Workflows - Git SCM
This technique allows you to context-switch quickly and completely — because your work is separated into silos where all the changes in that...
Read more >
Site deploys overview - Netlify Docs
There are four predefined deploy contexts: production : this context corresponds to the main site's deployment, attached to the Git branch you set...
Read more >
Git Magic - Chapter 4. Branch Wizardry
Branch Wizardry. Instant branching and merging are the most lethal of Git's killer features. Problem: External factors inevitably necessitate context switching.
Read more >
Manage Git branches | PyCharm Documentation - JetBrains
In the Log view, select the commit that you want to act as a starting point for the new branch and choose New...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found