如何设置我的第一个github存储库?

问题描述 投票:0回答:1

由于学习曲线的原因,我一直推迟创建 github 存储库。现在我知道我是对的!我想建立一个公共存储库,以提供一些使用 lewansoul 伺服系统的代码。我尝试使用这个指南,但很快我就开始收到错误消息。

我开始于:

git config --global user.name "fredbloggs"
git config --global user.email "[email protected]"
git config --global color.ui true
git config --global core.editor geany

我也成功设置了ssh认证:

ssh -T git@Hi fredbloggs! 
You've successfully authenticated, but GitHub does not provide shell access.

然后我进入我的项目目录并尝试设置存储库。我设法解决了以下富含行话的错误:

fatal: No configured push destination.

fatal: The current branch master has no upstream branch.

ERROR: Repository not found.

我必须先在 github 中创建存储库,然后使用以下命令:

cd lewansoul-lx16s
git init
git add lx16a.h main.py newlx16a.c README.md .gitignore
git commit -m "Initial commit"
git branch -M master
git remote add origin [email protected]:fredbloggs/lewansoul-lx16a.git
git push -u origin master
Enumerating objects: 7, done.
Counting objects: 100% (7/7), done.
Delta compression using up to 12 threads
Compressing objects: 100% (6/6), done.
Writing objects: 100% (7/7), 5.57 KiB | 5.57 MiB/s, done.
Total 7 (delta 0), reused 0 (delta 0), pack-reused 0
remote: error: GH007: Your push would publish a private email address.
remote: You can make your email public or disable this protection by visiting:
remote: http://github.com/settings/emails
To github.com:fredbloggs/lewansoul-lx16a.git
 ! [remote rejected] master -> master (push declined due to email privacy restrictions)
error: failed to push some refs to 'github.com:fredbloggs/lewansoul-lx16a.git'

最后的错误把我难住了。我不想公开我的电子邮件地址,所以我按照一些建议设置了虚拟电子邮件并运行:

git config --global user.email“[电子邮件受保护]

...但这并不能解决错误。我现在该怎么办?

我也非常感谢有关设置一个实际有效的简单公共存储库的指南。

git
1个回答
0
投票

简单的解决方案:

  1. 使用 Github 网站创建一个新的存储库。
  2. 按照屏幕上的说明操作并设置本地存储库。

如何尝试解决您的问题。

  • Github 阻止您使用私人电子邮件。
  • 正如您提到的,您应该执行以下操作:
# Set "private" github email
git config --global user.email {ID}+{username}@users.noreply.github.com

###
### You missed this part
### Reset the author information on your last commit:
###
git commit --amend --reset-author

下一步:推送您的代码

© www.soinside.com 2019 - 2024. All rights reserved.