gpt4 book ai didi

带有 VSCode 和 Ubuntu 的 Git 配置问题

转载 作者:行者123 更新时间:2023-12-04 18:58:44 26 4
gpt4 key购买 nike

经过反复试验,我能够更改 .gitconfig 的权限我的本地用户中的文件 /home/目录。此权限更改允许我添加 user.nameuser.email .如果这浪费了任何人的时间,我深表歉意,我非常感谢所有的帮助。特别是@phd、@jD3V 和@VonC
我真的用这个把我的头撞在我的 table 上。
我有一个远程 GitHub 存储库,已在本地克隆到我的机器,并且正在对剧本进行编辑。当我将更改提交到 GitHub 时,VSCode 会引发错误:

*** Please tell me who you are.

Run

git config --global user.email "you@example.com"
git config --global user.name "Your Name"

to set your account's default identity.
Omit --global to set the identity only in this repository.

fatal: no email was given and auto-detection is disabled
[2022-04-23T18:08:35.512Z] > git config --get-all user.name [1ms]
我以前也遇到过这个问题,没什么大不了的。这是 Pop!_OS 的全新安装,所以我还没有编辑我的 git 配置。我输入以下内容 -
git config --global user.name My_GitHub_Username
其次是 -
git config --global user.email My_email_name@gmail.com
输入时,它们似乎都运行正确,因为输入时我没有收到任何错误。但是,当我检查 git configgit config --list终端没有返回任何内容。当我再次以 root 身份运行它时,我看到了我的用户名 -
username@pop-os:~$ sudo git config --list
user.name=My_GitHub_username
user.email=My_email_name@gmail.com
尝试再次提交代码会引发相同的错误。我检查过类似的线程/解决方案 here , herehere ,所有这些都没有解决我的问题。
我忘了包括我曾尝试将两者都作为 sudo 运行。并得到相同的结果。这是`sudo nano ~/.gitconfig的输出 -
[alias]
lg1 = log --graph --abbrev-commit --decorate --date=relative --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all
lg2 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all
lg = !"git lg1"
[color]
ui = true
[help]
autocorrect = 3
我可以继续添加 [user]吗? user.name 的别名和 user.email选项填写?
有什么想法我可能做错了吗?我对 git 不是很熟悉,但会喜欢任何和所有的建议。

最佳答案

要扩展评论,git config --global做修改~/.gitconfig ,即 /home/<you>/.gitconfig .
这与 sudo xxx 不同。 ,它以root身份执行命令。root主文件夹是 /root .
/root/.gitconfig未被您的初始 git config 修改命令。
一般来说,不使用 root ,是可能的,是一条明智的路线。

关于带有 VSCode 和 Ubuntu 的 Git 配置问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71982562/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com