VSCode with activated ssh-agent on Windows 10
I want to use git from within VSCode, using my ssh-key. My current working fix is this:
- start Powershell
- run start-ssh-agent.cmd (of git installation)
- run code
This links the ssh agent or socket to VSCode, effectively allowing me to use the key for git commands.
How do turn this into a proper script? Or even better: How do I start and configure the ssh-agent automatically so it's globally available (similar to ssh-add on linux)?
See also questions close to this topic
How to collaborate with poeple using Dropbox if I prefer to use Git (Github)?
Is there tricks from
git, (or command-line/
WSL_on_Windows), such that I will be hosting the git-repo locally, in wherever I prefer, and have only the real files synced two-ways between the local git-repo and a Dropbox folder?
Even shorter: is there a way to push from a local repo to a Git remote, and have the files stay "two-way-synced" to a Dropbox folder before and after the push?
At the end of the day, I would like to keep pushing to the remote git-repo as usual. I will push shortly after committing, and would prefer all file-contents from the two sources (the Dropbox folder and the local copy of the Git-repo) to stay synced before and after the commit-push activities. (I am less confident here as this may go against the philosophy of "staging" my works per each commit.)
Clarification: I do not intend to do anything fancy with Git. I prefer to keep working with the same branch, and to pull/push from/to the same Github repo as the remote. In particular, I will need to get things to work on multiple PCs and a Linux machine.
- First, I think it is a bad idea to initialize a git-repo inside the
~/Dropboxfolder, as it creates clutters and thereby, likely, conflicts.
- I have thought about creating a "Selective-sync" through the Dropbox GUI to simply exclude the
.gitfolder. Yet, without such
.gitfolder, it is unclear how to establish the local repo on all computers of mine (I do use multiple Windows PC and one more Linux box).
- I am not good at
symlink, and have been playing with it a good number of times but failed. If someone were to suggest it, please be precise. Also, I would need it to work across multiple Windows machines and Linux box. I am happy to add more details as long as I get a working demo from you.
Thankfully, my collaborators has improved from the emailing habit of handing off drafts and work-in-progress through piles of zip-files. Nowadays, they are happy with a shared Dropbox folder. Yet, they haven't started to care too much about version control. Quotes from them: "Git on the command-line? It is a joke?" lol.
On the other hand, I have been happy with pushing to Github as my remote repo, and have been doing so for a good number of years. I am used to my git commands, and have devised the following
aliassettings to do so quickly.
alias ga='git add -A' alias gs='git status' alias gc='git commit -m' alias gp='git push' alias gpp='git pull'
I am looking for a way to use Git(Github) and Dropbox in harmony. And I am aware of the following knowledge:
- How to use
gitoccasionally when hosting everything on Dropbox ==> I am not a paid user of Dropbox, and my projects may easily overgrow my limit.
- Details on Git and Github
- Brilliant notes on using Dropbox as a Git (remote) repository
- Super convening marking material to pull people from Dropbox to Git (Github)
Among the three unsuccessful attempts on my end, I am inclined to believe some
symlinkcommand (or complicated scripts) will do the trick. Looking forward to further instruction from the community. I am tagging as many vision control
gitignore pattern doesn't work without double stars
This pattern works properly:
But this pattern doesn't:
As far as I know, these two patterns are equivalent. What might be the problem here?
git: Split existing repository into submodules
I only found answers on how to use git subtrees to split up a repository. However, I explicitly want submodules.
It's a Java maven project. Currently, everything is in one maven project and one repository. My goal is to achieve something like this:
The root repository should contain the main pom.xml, system documentation, etc Then there should be a few submodules, one for a utility library, one for the main application, and so on. The submodules are their own maven project, referenced from the main maven project in the root repository. The root repository will not contain any source code.
I could create everything new from current HEAD, but it is important to me that the commit history is kept as complete as possible.
How to copy SSH from JENKINS host into a DOCKER container?
I can't copy the file from the host into the container using the Dockerfile, because i'm simply not allowed to, as mentioned in Docker Documentation:
The path must be inside the context of the build; you cannot COPY ../something /something, because the first step of a docker build is to send the context directory (and subdirectories) to the docker daemon.
I'm also unable to do so from inside jenkins job, because the job commands run inside the shell of the docker container, there is not way to talk to the parent(which is the jenkins host).
This jenkins plugin could have been a life saver, but as mentioned in the first section: distribution of this plugin has been suspended due to unresolved security vulnerabilities.
git push doesn't prompt me for a password when invoked from terminator instead of konsole
I have a remote git repository on a gitlab server.
I'm accessing the server via ssh. When I type
git pushfrom a
Konsole-window, it works perfectly fine, and git asks me for the passphrase for my ssh-key pair.
I type in my password and the push is performed. When I try doing the same thing from a
Terminator-window, it doesn't work. Instead Terminator outputs
Enter passphrase for key '/example/directory/user/.ssh/id_rsa': email@example.com's password: Permission denied, please try again. firstname.lastname@example.org's password: Permission denied, please try again. email@example.com's password: Permission denied (publickey,password). fatal: Could not read from remote repository.
without ever asking me to input my passphrase. How can I change this behaviour?
Upgrade Centos 6 to Centos 7 using ssh
I have a server with the latest version of
centos6and want to upgrade it to
I don't have physical access to the machine.
Is there any way to upgrade to
Change the styling of function arguments in VS Code
I'm trying to edit the styling in my Visual Studio Code workspace and I don't know how to edit the styling of function arguments. I have found that you can style parameters (using textMateRules and
"scope" = "variable.parameter") but can't find anything on styling arguments (when calling the function as opposed to defining it.)
Hopefully someone could find me the textMateRules scope name or some other way of getting at it in VS Code settings. Thanks in advance!
Python + Multiprocessing + VMware: Process Hangs
Trying to run a simple test script in a Linux VM in VMware Workstation 15, in VSCode. The script just hangs at the worker pool, 'results = p.map(f, chunk)'. Not sure if I missed something to have it run in a VM or Linux. Runs fine in windows.
import multiprocessing as mp import os import time def f(x): print('Doing: ' + str(x) + ' with process id:'+ str(os.getpid()) + '\n') return(x*x) def main(): start_time = time.time() id_list = range(100) chunksize = 2 lock = mp.Lock() p = mp.Pool(chunksize) for i in range(0, len(id_list), chunksize): print(i) if (i + chunksize) > len(id_list): chunk = id_list[i:] else: chunk = id_list[i : i + chunksize] results = p.map(f, chunk) for j in range(len(results)): lock.acquire() try: print('The results is: ' + str(results[j]) + '\n') finally: lock.release() p.close() end_time = time.time() print(end_time - start_time) if __name__ == "__main__": print("Starting") main() print("Done")
Can't zoom out in visual studio code
I accidentally hit CTRL + = and my IDE is too much zoomed now. I tried the shortcut to zoom out as stated in the official vscode doc, (CTRL + -) but this is not working.
Some help would be appreciated.
Credential Provider V2 Combobox unexpected behavior
I've been developing our company's credential provider for windows 10 for almost a year now.
Now, I encountered a problem. I don't usually ask questions on forums, blogs, because in most cases I find the solution, but this time I've been struggling with an issue for a month now and I found the root of the problem.
Brief description of the problem itself: The credential provider uses a combobox, which worked before without a problem. Now, I rewrote the whole code to manage a big update, but a strange bug got into the system. The bug only occurs at a specific scenario. I'm developing and testing the code on my personal laptop.
1) The laptop is plugged in to my monitor / power, etc.
2) I make it go sleep.
3) I unplug all cables (including power).
4) I wake it up from sleep.
Than, the combobox doesn't show a default selected item, it's empty. When I drop it down, it shows all the necessary items. Than the credprov crashes and restarts, than everything is fine.
I know, that in similar "strange" scenarios, in most of the cases, a memory leak or something related causes the problem. When I check the event viewer it shows me c0000005, which is access violation. I started to debug where the violation is. Than I found out that the program refers the combobox item list array (actually vector in my case) at a very very high index (out of range could be the reason for the violation). The actual index is obviously stored in the "selectedComboItemIndex" variable (DWORD).
I was curious when did it change to this strange number, than I found an unexpected behavior. The SetComboBoxSelectedValue method randomly gets called once (when the bug happens) with an insanely high index value. I don't even call this method in my code, so I have no idea, why does it get called. The call happens even when I don't drop down the combobox.
I give it a chance that it could be a bug in the credprov itself. What do you think? Have you seen this problem before?
Thank you in advance!
Regex: Search particular diacritics and replace it in particular tag with ASCII (notepad++)
I have many html lines with words that contains
ădiacritic such as:
creatăoare, singură, acasă, etc. from the tag
I want to find all those
ădiacritics from that tag, ant to replace it in ASCII with
I made a regex, but the "replace" doesn't work.
Matlab 2013b 32 bit, error while installing mcr_install_win32, invalid code lenghts set
I'm trying to install Matlab 2013b 32 bit (I need this precise version) with accademic license on my laptop with Windows 10 (64 bit), but when I try to install it, it stops (at 60% more or less) and it says "Extract error - The following error was detected while installing mcr_install_win32: invalid code lenghts set ". I tryed many other times to re-install it but I have the same problem, and I have no idea how can I solve it. I don't know if this info can be useful, but before I tried to install Matlab 2013b 32 bit, I had Matlab 2015 32 bit, and Matlab 2018b 64 bit, and I did not have any problem with these 2 versions (and of course I unistalled these 2 versions and I deleted the folders where were located Matlab files, before trying to install Matlab 2013b 32 bit following the instructions written here: https://it.mathworks.com/downloads/web_downloads/select_products?dl_action=choose_products&platform=win32&release_name=R2013b&tab=f ).
Please don't tell me to change Matlab version (it's not a decision of mine to use this precise version), and please try to explain in a simple and specific way. Any help and advice will be very appreciate. Thanks in advance.
ssh-add in docker - Could not open a connection to your authentication agent
I am trying to create a docker image for my Python flask API.
I need git to install dependencies and I have already installed git in docker few times. But here, I cannot understand what I'm doing wrong.
With the docker:
FROM python:3.6-slim ARG ssh_prv_key ARG ssh_pub_key RUN apt-get update && \ apt-get install -y openssh-server &&\ apt-get install -y git # Authorize SSH Host RUN mkdir -p /root/.ssh && \ chmod 0700 /root/.ssh && \ ssh-keyscan github.com > /root/.ssh/known_hosts # Add the keys and set permissions RUN echo "$ssh_prv_key" > /root/.ssh/id_rsa && \ echo "$ssh_pub_key" > /root/.ssh/id_rsa.pub && \ chmod 600 /root/.ssh/id_rsa && \ chmod 600 /root/.ssh/id_rsa.pub && \ echo "StrictHostKeyChecking no " > /root/.ssh/config RUN eval "$(ssh-agent -s)" RUN ssh-add /root/.ssh/id_rsa RUN mkdir -p /usr/src/app WORKDIR /usr/src/app COPY requirements.txt /usr/src/app/ RUN pip3 install --no-cache-dir -r requirements.txt # Remove SSH keys RUN rm -rf /root/.ssh/ COPY ./my_api /usr/src/app # Expose the Flask port EXPOSE 5000 CMD [ "python", "./app.py" ]
I execute the command:
docker build --build-arg ssh_prv_key=.keys/id_rsa --build-arg ssh_pub_key=.keys/id_rsa.pub -t my-api -f Dockerfile .
Which gives me the error below:
Step 7/16 : RUN eval "$(ssh-agent -s)" ---> Running in be450cc39533 Agent pid 9 Removing intermediate container be450cc39533 ---> fb101226dc5f Step 8/16 : RUN ssh-add /root/.ssh/id_rsa ---> Running in 4288e93db584 Could not open a connection to your authentication agent. The command '/bin/sh -c ssh-add /root/.ssh/id_rsa' returned a non-zero code: 2
A PID is retrieved by the eval function for the ssh-agent but I cannot connect to it.
I finally found what I was doing wrong. First of all, my build args wasn't correct. The correct docker build command is as follow:
docker build --build-arg ssh_prv_key="$(cat .keys/id_rsa)" --build-arg ssh_pub_key="$(cat .keys/id_rsa.pub)" -t my-api -f Dockerfile .
Also, and I don't know why, git handle correctly my ssh keys without usage of
RUN eval "$(ssh-agent -s)" RUN ssh-add /root/.ssh/id_rsa
The commands above resulting into an could not connect to your agent error.
Then, the right file is
FROM python:3.6-slim ARG ssh_prv_key ARG ssh_pub_key RUN apt-get update && \ apt-get install -y git # Authorize SSH Host RUN mkdir -p /root/.ssh && \ chmod 0700 /root/.ssh && \ ssh-keyscan github.com > /root/.ssh/known_hosts # Add the keys and set permissions RUN echo "$ssh_prv_key" > /root/.ssh/id_rsa && \ echo "$ssh_pub_key" > /root/.ssh/id_rsa.pub && \ chmod 600 /root/.ssh/id_rsa && \ chmod 600 /root/.ssh/id_rsa.pub RUN mkdir -p /usr/src/app WORKDIR /usr/src/app COPY requirements.txt /usr/src/app/ RUN pip3 install --no-cache-dir -r requirements.txt # Remove SSH keys RUN rm -rf /root/.ssh/ COPY ./my_api /usr/src/app # Expose the Flask port EXPOSE 5000 CMD [ "python", "./app.py" ]
Deploy with Jenkins into CentOS 7.5 using pipeline script
I need help with pipeline jenkins deploy, I try to deploy a Java webapps from jenkins into CentOS, I always have this error :
FATAL: [ssh-agent] Could not find specified credentials
[ssh-agent] Looking for ssh-agent implementation...
[ssh-agent] FATAL: Could not find a suitable ssh-agent provider
[ssh-agent] Diagnostic report
[Pipeline] // sshagent
[Pipeline] // node
[Pipeline] End of Pipeline
java.lang.RuntimeException: [ssh-agent] Could not find a suitable ssh-agent provider.
Git Bash asks for SSH passphrase on first run after every PC reboot
Every time I start up Git Bash after restarting my Windows 10 PC it asks me for the passphrase for my SSH key.
I didn't used to have this problem, and I've never seen it anywhere else; I use Git Bash at work and have never seen this problem there.
Initializing new SSH agent... succeeded Enter passphrase for /c/Users/User/.ssh/id_rsa:
If I close the Git Bash window and open a new one, the new window doesn't prompt me for a passphrase. Nor will any subsequent window. It doesn't seem to matter whether I enter a passphrase in the first window or not.
However, if I restart, the first Git Bash window will again prompt me for a passphrase.
I've tried uninstalling and reinstalling Git. I've also tried running
ssh-add -k path/to/key. Neither approach worked.