如何在 Visual Studio Code 中执行 git push?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/29993599/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to do git push in Visual Studio Code?
提问by zhouji
There is a "Push" menu item, but when I click on it, nothing happens except for a subtle progressing bar showing up and never finished. From Visual Studio Code's Docs page, I found this line: "Credential management is not handled by VSCode for now," and that page links to a GitHub page on credential helper, which is too specific for other remote server (in my case, bitbucket) and not specific enough on how to set up for VS Code.
有一个“推送”菜单项,但是当我点击它时,除了一个微妙的进度条出现并且从未完成之外,什么也没有发生。从 Visual Studio Code 的 Docs 页面,我发现了这一行:“凭证管理目前不由 VSCode 处理”,并且该页面链接到凭证帮助程序上的 GitHub 页面,这对于其他远程服务器(在我的情况下是 bitbucket ) 并且对如何设置 VS Code 不够具体。
采纳答案by Esteban Quintana
If you are in windows use this line in your git bash:
如果您在 Windows 中,请在您的 git bash 中使用这一行:
git config --global credential.helper wincred
git config --global credential.helper wincred
Next time git will remember your password. Thats all, the VSCode will work fine ;)
下次git会记住你的密码。就是这样,VSCode 可以正常工作;)
Bye Bytes !
再见字节!
回答by behzad abbasi
Tell Git your name so your commits will be properly labeled. Type everything after the $ here:
告诉 Git 你的名字,这样你的提交就会被正确标记。在 $ 后面键入所有内容:
git config --global user.name "YOUR NAME"
git config --global user.name "你的名字"
Tell Git the email address that will be associated with your Git commits. The email you specify should be the same one found in your email settings on Github. To keep your email address hidden, see "Keeping your email address private".
告诉 Git 将与您的 Git 提交关联的电子邮件地址。您指定的电子邮件应该与您在 Github 上的电子邮件设置中找到的相同。要隐藏您的电子邮件地址,请参阅“将您的电子邮件地址保密”。
git config --global user.email "YOUR EMAIL ADDRESS"
git config --global user.email "您的电子邮件地址"
See this : Set Up Git
请参阅:设置 Git
回答by travistravis
回答by Alex Dima
Currently, VSCode implements git integration by spawning git
. If git push
works on your command line without prompting for username / password, it should work from VSCode too.
目前,VSCode 通过生成 .git 实现 git 集成git
。如果git push
在您的命令行上工作而不提示输入用户名/密码,它也应该在 VSCode 上工作。
I don't know if setting up SourceTree to not prompt for a username / password is sufficient to get vanilla command line git
not prompt as well.
我不知道将 SourceTree 设置为不提示输入用户名/密码是否足以让 vanilla 命令行git
不提示。
回答by Spiegie
if you want push to an own server where you need to enter a password because you use ssh authentification you can do it like this:
如果您想推送到您需要输入密码的自己的服务器,因为您使用 ssh 身份验证,您可以这样做:
Start Visual Studio Code from the git commandpromt with the command code
使用命令从 git commandpromt 启动 Visual Studio Code code
I found this at the end of this page https://code.visualstudio.com/Docs/editor/versioncontrolin the FaQ the Question was "Can I use SSH Git authentication with VS Code?"
我在此页面的末尾https://code.visualstudio.com/Docs/editor/versioncontrol在常见问题解答中找到了这个 问题是“我可以在 VS Code 中使用 SSH Git 身份验证吗?”
now every time you interact with the git server you get prompted for the password
现在每次与 git 服务器交互时都会提示您输入密码
here is a guide how to run a command with git when you open git Windows shortcut to run git bash script
这是一个指南,当您打开 git Windows 快捷方式运行 git bash 脚本时,如何使用 git 运行命令