我在一两年前手动安装了 git 1.6。我今天注意到 1.7 版本在 yum 中可用,并安装它(包 git-all)我现在得到以下输出:
[root@ovz5197 ~]# git --version
bash: /usr/local/bin/git: No such file or directory
[root@ovz5197 ~]# which git
/usr/bin/git
[root@ovz5197 ~]# /usr/bin/git --version
git version 1.7.4.1
[root@ovz5197 ~]#
Run Code Online (Sandbox Code Playgroud)
知道为什么输出which似乎与上面的第一行矛盾吗?
我和你们中的许多人一样使用 Git。此外,我不使用任何 GUI — 只是 CLI。所以我想知道:有没有什么办法可以使Git命令(git status,git checkout等)完成自己打标签时?就像其他 CLI 命令一样。
PS 我正在使用 Arch Linux,如果这很重要的话。
$ git commit
error: cannot run vim: No such file or directory
error: There was a problem with the editor 'vim'.
Please supply the message using either -m or -F option.
Run Code Online (Sandbox Code Playgroud)
如何克服错误并定义编辑器?
我在 VPS 上托管我自己的 git 存储库。假设我的用户是约翰。
我使用 ssh 协议来访问我的 git 存储库,所以我的 url 类似于ssh://john@myserver.com/path/to/git/myrepo/.
Root 是所有内容的所有者 /path/to/git
我正在尝试授予 john 对所有内容的读/写访问权限 /path/to/git/myrepo
我都试过chmod,并setfacl控制访问,但都失败了同样的方式:他们递归应用的权利(与正确的选项),以所有当前存在的子目录的/path/to/git/myrepo,但只要创建一个新的目录,我的用户不能写在新目录中。
我知道 git 中有一些钩子可以让我在每次提交后重新申请权限,但我开始认为我走错了路,因为这对于一个非常基本的目的来说似乎太复杂了。
问:我应该如何设置我的权利,让 john 访问 john 下的任何东西,/path/to/git/myrepo并使其适应树结构变化?
Q2:如果我应该退后一步更改一般方法,请告诉我。
编辑:问题已按原样回答,但这是错误的问题。正确的问题应该是“如何在服务器上配置裸 git 存储库以用于 ssh 访问?”。看我自己的回答。
我在 domain.fr 上有一台 CentOS 5 服务器。我正在尝试设置一个子域,以便我可以将它与 git 一起使用: git.domain.fr
我的存储库在 /home/git (例如 /home/git/repos.git)
我已经安装了git-http-backendNginx。我已经设置了这样的存储库:
cd /home/git/repos.git && git --bare init
Run Code Online (Sandbox Code Playgroud)
我已将我的git.conf(包含在 中nginx.conf)设置为如下。
但是,在我的客户端 shell 上,我收到致命错误“找不到存储库”: git clone http://git.domain.fr/repos.git
有谁知道我应该做什么?看起来很简单,我很沮丧,因为我确定这没什么。
server {
listen 80;
server_name git.domain.fr;
root /home/git;
location ~ /(/.*) {
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME /usr/bin/git-http-backend;
fastcgi_param GIT_HTTP_EXPORT_ALL true;
fastcgi_param GIT_PROJECT_ROOT /home/git;
fastcgi_param PATH_INFO $1;
fastcgi_pass unix:/var/run/fcgiwrap.socket;
}
}
Run Code Online (Sandbox Code Playgroud) 所以git archive --format=tar HEAD会给我一个当前分支上最新提交的 tar 存档。是否有包含对尚未提交的跟踪文件进行本地修改的版本?
我可以git clone这样做...
git clone https://github.com/stackforge/puppet-heat.git
Run Code Online (Sandbox Code Playgroud)
...没有问题。但是我想排除克隆附带的所有 git meta 内容,所以我想我会使用git archive但我收到此错误:
$ git archive --remote=https://github.com/stackforge/puppet-heat.git
fatal: Operation not supported by protocol.
Run Code Online (Sandbox Code Playgroud)
任何人都知道为什么或我做错了什么?
在本地克隆 git 存储库后,我想将分支切换到“ABCD”。
$ git branch -a
* master
remotes/origin/ABCD
remotes/origin/HEAD -> origin/master
remotes/origin/master
$ git checkout origin/ABCD #### <- Here is the problem!
Note: checking out 'origin/ABCD'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may
do so …Run Code Online (Sandbox Code Playgroud) 我在“admin”组中有 3 个用户A、B和C。我有另一个用户“ D ”,在其主目录中有一个project文件夹。我已将D设为该文件夹的所有者,并使用chgrp. 组和所有者拥有所有权限,但A、B或C仍然无法访问该文件夹。我有两个问题:
其他用户甚至可以访问其他用户目录中的任何内容吗
授予组权限只会使该组中的用户可以访问任何用户主目录之外的文件?
编辑:这是我设置项目所有者和组的方式
sudo chown -R D project
sudo chgrp -R admin project
Run Code Online (Sandbox Code Playgroud)
我在尝试进入D主目录中的project文件夹时出错(以A身份登录)
cd /home/D/project
-bash: cd: /home/D/project: Permission denied
Run Code Online (Sandbox Code Playgroud)
这是ls -la命令的输出:
drwxrwsr-x 7 D admin 4096 Nov 18 13:06 project
Run Code Online (Sandbox Code Playgroud)
以下是该组的描述admin:
getent group admin
admin_users:x:501:A,B,C
Run Code Online (Sandbox Code Playgroud)
另请注意,admin当我groups从用户D键入时未列出组,但在我使用cut …
比方说,我有两个库aye和bee我想摆脱bee,这样的线性的历史,bee/master在一个新的子目录“重放”(几个层次深)的aye。我只想要文件和提交消息,我不关心提交 ID。我做想要一个合理的历史,所以git subtree add --prefix=subdirectory并git read-tree --prefix=subdirectory/没有什么我要找的。
两个存储库都是私有的,因此不存在为其他人重写历史记录的风险。但是,bee 确实有一个子模块cee。
git ×10
autocomplete ×2
centos ×2
permissions ×2
bash ×1
command ×1
command-line ×1
github ×1
group ×1
nginx ×1
security ×1
version ×1
vi ×1
zsh ×1