在 Qt Creator 中设置 git
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/27708127/
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
Setup git in Qt Creator
提问by qloq
Can someone explain what git properties in Qt Creator are about?
I've installed Qt Creator & git. There is "General" tab in Creator's "Options->Version control" & there are few options: path to check scripts, path to configuration files & SSH promt command. Should I create these files by myself?
In "git" tab there is field "Prepend to path". Is it path to git? Such as "/usr/lib/git"?
And finally what is command for "Repository browser"?
有人可以解释一下 Qt Creator 中的 git 属性是什么吗?
我已经安装了 Qt Creator 和 git。Creator 的“选项->版本控制”中有“常规”选项卡,选项很少:检查脚本的路径、配置文件的路径和 SSH promt 命令。我应该自己创建这些文件吗?
在“git”选项卡中有“Prepend to path”字段。它是 git 的路径吗?比如“/usr/lib/git”?
最后什么是“存储库浏览器”的命令?
回答by Neurotransmitter
For 64-bit Windows.
对于 64 位Windows.
- Install Git for Windows.
- Place
C:\Program Files\Git\bin
in Tools> Options...> Version Control> Git> Prepend to PATH:
- 安装适用于 Windows 的 Git。
- 放置
C:\Program Files\Git\bin
在工具>选项...>版本控制>的Git>前置到PATH:
- Setup your local git repository in any suitable (Git Bash for example) console (
cd /c/project
,git init
,git add *
,git commit
,git remote add origin git@someserver:/some/path/to/project.git
,git push
). - Work with your project in Qt Creator via Tools> Git> Local Repository> Commit...> Commit and Push...
- 在任何合适的(例如 Git Bash)控制台 (
cd /c/project
,git init
,git add *
,git commit
,git remote add origin git@someserver:/some/path/to/project.git
,git push
) 中设置您的本地 git 存储库。 - 通过工具> Git>本地存储库>提交...>提交和推送...在 Qt Creator 中处理您的项目
That's all. Probably you'll want to use passwordless SSH key, because Qt Creator can't easily handle SSH password entering (and storing). Some third-party tools can do this for it, though. If you want to remove the password from your SSH key, use ssh-keygen -p
.
就这样。您可能想要使用无密码 SSH 密钥,因为 Qt Creator 无法轻松处理 SSH 密码输入(和存储)。不过,一些第三方工具可以做到这一点。如果要从 SSH 密钥中删除密码,请使用ssh-keygen -p
.
回答by Axel Plinge
Note that when you are using mysysgit under windows, and you have not added it to the PATH, you can set the "Prepend to path" field in the git configuration to this:
注意,当你在windows下使用mysysgit,并且还没有添加到PATH中时,可以将git配置中的“Prepend to path”字段设置为:
C:\Users\your account\AppData\Local\Programs\Git\mingw64\bin\
C:\Users\您的帐户\AppData\Local\Programs\Git\mingw64\bin\
In order for git to work.
为了让 git 工作。
回答by orgads
The General tab contains common options for all VCS systems. The defaults are usually ok, you don't need to touch anything if it works for you. One setting there that you might want to modify is "Wrap submit message at".
General 选项卡包含所有 VCS 系统的通用选项。默认值通常没问题,如果它适合你,你不需要触摸任何东西。您可能想要修改的一项设置是“Wrap submit message at”。
In Git options, Prepend to PATH is used to set the path to git in case you don't have it on the system PATH, or you'd like to use a version that is installed elsewhere. This is mostly used on Windows, it is not mandatory.
在 Git 选项中,Prepend to PATH 用于设置 git 的路径,以防您在系统 PATH 上没有它,或者您想使用安装在其他地方的版本。这主要用于 Windows,它不是强制性的。
The Repository Browser is an optional executable that is available through the menu Tools -> Git -> Tools -> Repository Browser. It is convenience only, not mandatory either (I never used it).
存储库浏览器是一个可选的可执行文件,可通过菜单工具 -> Git -> 工具 -> 存储库浏览器访问。这只是方便,也不是强制性的(我从未使用过它)。