我在 GitHub 上有一个现有的存储库。它是私人的,所以很抱歉我无法在这个问题中提供 URL。我的文件夹中有一些代码。该文件夹没有 .git 文件夹。我想将此文件夹与远程存储库“连接”或“链接”。我正在使用这个文档。
到步骤 4 为止一切都很顺利。然后我收到此错误:
% git init -b main
error: unknown switch `b'
Run Code Online (Sandbox Code Playgroud)
我在这里做错了什么?
小智 5
你可以这样:
# Initialize a git repo on current folder
git init .
# Stage all objects in current folder (including subfolders)
git add .
# Commit git changes
git commit -m "First Commit"
# Add a Remote Git Repo
git remote add origin https://github.com/xxxx
# Finally push changes from local repo to remote repo
git push origin main
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2266 次 |
| 最近记录: |