GitLab and Visual Studio Code

谁说胖子不能爱 提交于 2020-01-24 22:09:00

问题


I'm trying to integrate the visual sutdio code as gitlab to perform version control of source codes.

I did not find anything that would help me during the google searches, so I'm asking here.

Has anyone managed to integrate?

I'm using GitLab's free account and I want to commit / push / clone through Visual Studio Code, is it possible?


回答1:


In the Marketplace you find a lot of Visual Studio Code Extensions. They are labeled with tags, e.g.

  • tag:git
  • tag:gitlab

Which to use depends on your preferences and scenarios. I recommend and I am personally using GitLens — Git supercharged.

The installation in Visual Studio Code is easy, for GitLens e.g.:

Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.

ext install eamodio.gitlens

The documentation you find on the extension page, see link above.




回答2:


In Windows, once ssh keys are settled in your machine and you have git installed (e.g. Git-2.20.1-64-bit.exe), you then need to setup the git inside VScode.

In the terminal of VScode setup the global config:

    git config --global user.email "xx.xxxx@mail.com"

In the same terminal, navigate to your local directory where you want to setup the remote repository from gitlab.

Then since you are creating a new remote repository in GitLab (e.g inside NewFolder with repo.git as the git name) type :

    git clone ssh://git@gitlab.com/NewFolder/repo.git

In the same terminal, navigate to your newly created local folder called "repo"

   cd repo

You can then add files into that local folder "repo". Then in the VScode source control button, stage the changes and click the check icon to commit it.

Once committed, you can then publish it via VScode interface.

or manually by typing:

    git add .
    git commit -m "Initial commit"
    git push -u origin master


来源:https://stackoverflow.com/questions/53525536/gitlab-and-visual-studio-code

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