我对Git很新,并开始使用GitHub for Windows。 现在我已经学会了如何打开Git bash ....并且想要将Git Flow安装到其中。
我正在尝试按照这里的步骤: - https://github.com/nvie/gitflow/wiki/Windows
在安装过程中,当我尝试使用PortableGit文件夹的路径运行msysgit-install脚本时,脚本无法说: -
contrib/msysgit-install.cmd: line 1: @echo: command not found
contrib/msysgit-install.cmd: line 2: setlocal: command not found
等...
我有什么问题,或者我的bash没有正确设置?
我通过右键单击GitHub for Windows中的项目并选择“在这里打开一个shell”来访问bash。
请帮忙。
答案 0 :(得分:5)
msysgit-install.cmd
脚本是一个Windows批处理文件,不要从bash运行它从Windows命令提示符运行它(或者从文件浏览器中双击它,但我不确定这是否适用于.cmd
档案...)
另外,请尝试使用Cygwin。它简单得多。
答案 1 :(得分:3)
util-linux-ng-<version>-bin\bin\getopt.exe
文件复制到C:\Program Files\Git\bin
util-linux-ng-<version>-dep\bin\libintl3.dll
和util-linux-ng-<version>-dep\bin\libiconv2.dll
个文件复制到C:\Program Files\Git\bin
git clone git://github.com/nvie/gitflow.git
cd gitflow
git submodule
git submodule init
git submodule update
Windows console
并转到您克隆存储库的contrib
目录中的gitflow
目录:cd C:\... ...\gitflow\contrib\
msysgit-install.cmd "C:\Program Files (x86)\Git"
答案 2 :(得分:0)
我的建议是使用Chocolatey并在此处安装4个包:Chocolatey Git-Flow related packages。
确保将Git \ bin安装目录添加到环境变量中的路径。
确保重新启动cmd.exe并运行import org.apache.http.Header;
import org.apache.http.HttpException;
import org.apache.http.HttpHost;
import org.apache.http.HttpRequest;
import org.apache.http.client.HttpClient;
import org.apache.http.client.ResponseHandler;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.conn.routing.HttpRoute;
import org.apache.http.conn.routing.HttpRoutePlanner;
import org.apache.http.impl.client.BasicResponseHandler;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.conn.DefaultRoutePlanner;
import org.apache.http.impl.conn.DefaultSchemePortResolver;
import org.apache.http.protocol.HttpContext;
public class Main {
public static void main(String[] args) throws Exception {
// this works fine
testAbsolutePath();
// this throws org.apache.http.client.ClientProtocolException
// if you don't specify target Host.
// i'm setting HttpRoutePlanner on HttpClient in this example to do this
testRelativePath();
}
public static void testAbsolutePath() throws Exception{
HttpClient client = HttpClientBuilder.create().build();
String absolutePath = "http://stackoverflow.com/questions/30605198/what-i-have-to-put-as-the-uri-of-my-httpget-method";
HttpGet absolutePathRequest = new HttpGet(absolutePath);
testRequest(absolutePathRequest, client);
}
public static void testRelativePath() throws Exception{
// the easiest way i could find to set default hostname for
// 'org.apache.httpcomponents:httpclient:4.3.6'
HttpRoutePlanner rp = new DefaultRoutePlanner(DefaultSchemePortResolver.INSTANCE) {
@Override
public HttpRoute determineRoute(final HttpHost host,final HttpRequest request,final HttpContext context) throws HttpException {
HttpHost target = host != null ? host : new HttpHost("www.stackoverflow.com");
return super.determineRoute(target, request, context);
}
};
HttpClient client = HttpClientBuilder.create().setRoutePlanner(rp).build();
String relativePath = "/questions/30605198/what-i-have-to-put-as-the-uri-of-my-httpget-method";
HttpGet relativePathRequest = new HttpGet(relativePath);
testRequest(relativePathRequest, client);
}
public static void testRequest(HttpGet request, HttpClient client) throws Exception {
System.out.println(request);
for (Header h : request.getAllHeaders()) System.out.println(h);
ResponseHandler<String> responseHandler = new BasicResponseHandler();
String responseBody = client.execute(request, responseHandler);
System.out.println(responseBody.substring(0, 100)); //substring because don't want to print all page
}
}
以确保其正常运行。