vscode里面如何配置库_如何在VSCode中使用私有存储库?

A novice here, please type a small instruction describes how to use a private GitHub repo in VSCode

解决方案

To configure a private repo, you first need to generate a public/private RSA key pair on your dev machine to be able to establish an ssh connection to your repo instead of an HTTP connection.

Just install Git for Windows in your development environment. During installation, please make sure that you have checked the option to include git bash, as you'll need it to create this key. Once installed, right click on your Windows user folder, select on Open git bash and then just run ssh-keygen (or if you are using Linux, you can just ssh-keygen) and go through the wizard.

This step will create a hidden .ssh folder that contains your public/private RSA key pair. Navigate to that folder.

The goal here with these keys is to configure your public key on GitHub. Open your id_rsa.pub file with notepad and copy its entire content. Then go to GitHub and under your user Settings > SSH keys just add a key and paste your entire public key plus an arbitrary name.

Now restart VS Code and press CTRL+ ' (Backtick) to open PowerShell and then run:

In case you haven't cloned your repo:

git clone git@github.com:{UserName}/{RepoName}.git

To Upload changes to your repo:

git add .

git commit -m "{Name for this commit}"

git push {Repo Origin name (default = Origin)} {Branch Name (Default = Master)}

Note. {} are for reference, do not include them in your commands.

VS Code has built-in support for Source Control, so if it is configured, VS Code will automatically detect changes and get them ready to commit with just a commit message and click. Also, there's a really good VS Core extension called GitLens. This can help you to 1-click push

That should do it. 😃

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值