标签: git

(git)diff输出相对路径?

我需要在我的仓库中获得一些与仓库基础无关的差异,而是相对于给定的基础或给定路径.

我默认得到:

git diff
diff --git a/path/to/file b/path/to/file
index 0cc125e..9bf911e 100644
--- a/path/to/file
+++ b/path/to/file
Run Code Online (Sandbox Code Playgroud)

但我想要的是:

git diff --prefix=/new/path/to
diff --git a/new/path/to/file b/new/path/to/file
index 0cc125e..9bf911e 100644
--- a/new/path/to/file
+++ b/new/path/to/file
Run Code Online (Sandbox Code Playgroud)

我查看了--relative选项(不是我要找的), - src/dst-prefix(这些只能改变"a"或"b"部分.我错过了一些基本的东西吗?

git diff patch git-diff difference

11
推荐指数
2
解决办法
8389
查看次数

github,sourcetree获得未经授权的错误

我是github的新手,我使用sourcetree为我的git gui,我已经使用了几天,但现在最近我得到一个错误,说

remote: Invalid username or password.
fatal: Authentication failed for 'https://github.com/Nosthertus/nodejs_Chat.git/'
Run Code Online (Sandbox Code Playgroud)

当我试图再次向github注册时返回错误

authorization failed
Run Code Online (Sandbox Code Playgroud)

也许是因为我做了一个双因素安全,我想用github制作一个shh-key,但是没有解决问题,必须有一种方法让我的gui连接到我的github帐户而无需登录访问,如何我能解决这个问题吗?

git atlassian-sourcetree

11
推荐指数
3
解决办法
3万
查看次数

使用PHP代码自动化git pull

我正在努力将"git pull"的任务从bit-bucket服务器自动化到我的godaddy共享主机.我已经在Godaddy服务器上安装了Git,并能够从命令行远程"git clone","git pull"等.但现在我想写一个PHP代码直接从浏览器运行'git pull'.

PHP函数exec()可用于此,但来自bit-bucket的git pull需要密码.我在互联网上搜索了很多,但无法找到如何从PHP代码提供密码.

注意:我已尝试在2台服务器(Godaddy - Bitbucket)之间设置无密码身份验证,但它无法正常工作.所以我只留下上面的方法.

编辑:我已完成设置,现在只需点击一下即可更新godaddy服务器.但是,由于对Godaddy的服务器的限制,PHP代码部分对我不起作用.所以我创建了一个批处理脚本,对服务器和自动git pull命令进行无密码验证.以下是执行此操作的步骤(可能对任何有类似问题的人有帮助):http://abhisheksachan.blogspot.in/2014/04/setting-up-godaddy-shared-hosting-with.html

php git bitbucket

11
推荐指数
1
解决办法
2万
查看次数

`git clean`默认删除被忽略的文件?

根据帮助,没有-x选项git clean应该更不用说被忽略的文件,但事实并非如此.

[il@reallin test]$ cat .gitignore
*.sar
[il@reallin test]$ mkdir -p conf/sar && touch conf/sar/aaa.sar
[il@reallin test]$ git status
# On branch master
nothing to commit, working directory clean
[il@reallin test]$ git clean -df
Removing conf/
Run Code Online (Sandbox Code Playgroud)

conf/sar/aaa.sar已移除.这是一个错误吗?

git

11
推荐指数
2
解决办法
1445
查看次数

特定服务器的http.sslCAInfo证书的.gitconfig语法是什么?

我正在通过https使用远程git存储库,它具有自签名证书.为了让git知道自签名证书,我在.gitconfig中有以下内容:

[http]
sslCAInfo = /home/user/myselfsigned.cert
Run Code Online (Sandbox Code Playgroud)

这工作正常,但是当我添加另一个带CA签名证书的远程时,git(或curl?)错误地尝试使用此远程的cert文件.将证书应用于特定远程的正确语法是什么?

git https certificate self-signed git-config

11
推荐指数
1
解决办法
1万
查看次数

问题推送到使用"使用README初始化repo"选项创建的GitHub存储库

我尝试使用GitHub文档中的说明创建一个GitHub存储库,除了不在README本地创建,我使用该README选项初始化了我的GitHub存储库.但是,在尝试推送之后,我得到了这个错误,我不完全理解:

kirby:cs61as_SCIP_schython \**user**$ git push origin master
https://github.com/chris-marie/cs61as_SICP_schython.git 
! [rejected] 
master -> master (fetch first) error: failed to push some refs to
'https://github.com/chris-marie/cs61as_SICP_schython.git' hint:
Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository
pushing hint: to the same ref. You may want to first merge the remote
changes (e.g., hint: 'git pull') before pushing again. hint: See the
'Note about …
Run Code Online (Sandbox Code Playgroud)

git github

11
推荐指数
2
解决办法
7642
查看次数

Python/pip,如何从github安装特定版本的git存储库(什么是正确的URL)?

我想通过pip安装Django 1.7.它目前是一个开发版本,因此不在pips存储库中.

所以我在使用之前已经从github安装了包:

pip install git+[url here]
Run Code Online (Sandbox Code Playgroud)

现在看github,我在django页面上获得了克隆url:

https://github.com/django/django.git
Run Code Online (Sandbox Code Playgroud)

但是这没有提及分支.如何指定我想要1.7版本?它是否在github页面上显而易见?

python git django github

11
推荐指数
1
解决办法
4034
查看次数

让TeamCity拉下所有git分支

在构建服务器上,我已经设置了TeamCity(8.1.1),以便在主服务器,其中一个功能分支或使用分支说明符的一个拉取请求分支中发生更改时执行构建过程:

+:refs/heads/*
+:refs/pull/(*/merge)
Run Code Online (Sandbox Code Playgroud)

我打开了构建代理选项:

teamcity.git.use.local.mirrors=true
Run Code Online (Sandbox Code Playgroud)

它将存储库克隆在构建目录之外的目录中,然后从该本地存储库中提取.

构建过程需要访问git存储库和主分支,即使对于其中一个功能分支或拉取请求分支的构建也是如此.但是TeamCity只有包含本地存储库中的更改的分支,从而使我的构建失败,例如当更改在issue/mycoolissue分支上时,那么这是TeamCity工作空间中git存储库中存在的唯一分支.

我尝试执行本地git fetch来获取主分支,但因为本地存储库没有主分支,所以失败了.虽然我可以添加一个远程指向源(一个github私有存储库),这意味着我也必须处理凭据,我宁愿让TeamCity为我处理所有这些.

我的问题是,是否有办法告诉TeamCity将所有分支都拉入本地存储库和工作存储库?

git teamcity

11
推荐指数
2
解决办法
3581
查看次数

如何使用BFG repo清除程序删除一个文件夹/目录?

如何使用BFG仅删除一个目录?

帮助说:

delete folders with the specified names (eg '.svn', '*-tmp' - matches on folder name, not path within repo)

这似乎意味着--delete-folders "config"将匹配存储库中任何位置的所有名为config的文件夹.

git git-rewrite-history bfg-repo-cleaner

11
推荐指数
1
解决办法
5820
查看次数

如何解决Eclipse中的脏索引?

我在eclipse中遇到以下问题:

在此输入图像描述

如何解决脏指数?

eclipse git pull github

11
推荐指数
1
解决办法
2万
查看次数