如何查找/列出全局和用户配置文件?我的意思是“Git 原生功能”,而不是像find.
我在笔记本电脑上有一个git存储库,以及GiHub上的远程存储库(运行'git clone'时创建的直接配置).
我正在使用SSH传输协议.即远程地址是:git@github.com:MyName/MyProg.git
我现在处于端口23被阻塞的网络环境中(据我所知,只有端口80和443打开).我需要获取/合并服务器上可用的最新更改.我有什么选择?如果可能的话,我想避免使用http协议创建一个新的远程分支(这与我已经拥有的远程分支基本相同).
使用git config user.email "some@email.com"在全局配置文件中设置用户电子邮件
使用git config --global user.email "some@email.com"或git config --local user.email "some@email.com"(从回购中)抛出:
"错误:一次只有一个配置文件."
我的全球.gitconfig:
[color]
ui = auto
[user]
name = My Name
email = my@email.com
[alias]
co = checkout
ci = commit
st = status
br = branch
hist = log --pretty=format:\"%h %ad | %s%d [%an]\" --graph --date=short
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%C(bold blue)<%an>%Creset' --abbrev-commit
type = cat-file -t
dump = cat-file -p
[push] …Run Code Online (Sandbox Code Playgroud) 我在本地更改了某些文件的权限并将其推送到 GITHUB,而我的 gitconfig 中没有 config.FileMode 标志 = false。所以 GIT 推送了文件模式更改,但我想将这些文件模式更改从 100755 恢复到 100644。我使用 MAC osx 作为我的开发环境。我不想在我的存储库上使用 git reset --hard HEAD。有什么建议 ?
我正在创建新分支并尝试推送分支(我尝试了以下命令):
git push --all -u
git push origin NewBranch
Run Code Online (Sandbox Code Playgroud)
但在这两种情况下,我都会收到此错误:
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Run Code Online (Sandbox Code Playgroud)
这是我的 .git/config:
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
precomposeunicode = true
[remote "origin"]
url = ssh://git@github.com/myName/myRepo.git
fetch = +refs/heads/*:refs/remotes/origin/*
pushurl = ssh://git@github.com/myName/myRepo.git
Run Code Online (Sandbox Code Playgroud)
这是起源:
origin ssh://git@github.com/myName/myRepo.git (fetch)
origin ssh://git@github.com/myName/myRepo.git (push)
Run Code Online (Sandbox Code Playgroud)
你们中的任何人都知道这个错误的原因吗?
我会非常感谢你的帮助
我正在研究终端中没有颜色的嵌入式系统(剥离的busybox)。当我使用 git 时,我总是要记住 --no-color 选项。
我知道我可以通过设置设置我的电子邮件
git config user.email
Run Code Online (Sandbox Code Playgroud)
但我似乎无法弄清楚如何做类似于 set 的事情,这样我就不必每次都添加它。
有什么办法可以将 .git/config 复制到远程服务器上。我想使用命令行在远程 url 端修改 http postBuffer。git push 是否也复制配置。
显然,可以使用以下gitconfig设置强制 Git 用户为每个新存储库添加电子邮件地址:
git config --global user.email "(none)"
git config --global user.useConfigOnly true
Run Code Online (Sandbox Code Playgroud)
我所做的。我的gitconfig -l输出(截断):
core.symlinks=true
core.autocrlf=true
core.fscache=true
color.diff=auto
color.status=auto
color.branch=auto
color.interactive=true
help.format=html
diff.astextplain.textconv=astextplain
rebase.autosquash=true
http.sslcainfo=C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt
diff.astextplain.textconv=astextplain
filter.lfs.clean=git-lfs clean -- %f
filter.lfs.smudge=git-lfs smudge -- %f
filter.lfs.required=true
filter.lfs.process=git-lfs filter-process
credential.helper=manager
core.autocrlf=true
core.eol=native
user.name=David Wright
user.email=(none)
user.useconfigonly=true
Run Code Online (Sandbox Code Playgroud)
但它似乎不起作用。我可以在不设置电子邮件地址的情况下提交。提交中列出的电子邮件地址(哦,奇迹)是“(无)”。
我正在使用git version 2.13.0.windows.1.
我想这样做是因为我在同一台计算机上使用两个不同的帐户。我能够实现在我的ssh-config文件中应用不同 ssh 密钥的类似设置:
# github account
Host github.com
Port 22
HostName github.com
User git
IdentityFile <file>
Run Code Online (Sandbox Code Playgroud)
但显然 git 本身没有这种可能性。
无论如何,我希望能够强制我必须为每个存储库设置一个用户电子邮件地址,并且我希望它成为我全局gitconfig …
在特定项目中,单词“feature”传递为大写。
For example:
git checkout -b "feature/#123123-test"
the name of branch will:
FEATURE/#123123-teste
if I put:
git checkout -b "otherthing/#123123-test"
will:
otherthing/#123123-test
Run Code Online (Sandbox Code Playgroud)
.gitconfig:
[filter "lfs"]
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
required = true
clean = git-lfs clean -- %f
[user]
name = Bruno
email = *******@******.com.br
Run Code Online (Sandbox Code Playgroud)
有人知道这里发生了什么事吗?
我喜欢我的标签显示为 4 个空格,为此我有首选项core.pager = 'less -x4'.
我知道此时我在吹毛求疵,但即使在差异模式下,我也希望前导标签为 4 个空格,这显然是最常用的 - 但是由于前导+, -,它仅显示为 3或。由于对齐的行,这有点烦人,如果有些没有前导选项卡,与其他人相比,它们会移动 1 列。
我可以更正差异的显示,less -x1,5以获得 4 个空格的选项卡,在列 1 模 4 上对齐。但是,此选项会导致前导选项卡在非差异模式下显示为 1 列,这反过来又非常令人不安。
因此,对于两个具体示例,我如何设置 git 选项以便我使用:
less -x1,5对于差异(或真正的补丁显示)命令,例如git diff或git show HEADless -x4 对于不显示差异的命令,例如 git show HEAD~1:package.json我确信必须有一个不同的渲染器来处理基本diff和cat操作,但我无法找到这些特定的选项(尽管它们可能存在,但关于 git 主题有很多噪音)。我也不想写一大堆别名,这有点太脏了。那么这甚至可能吗?