oiw*_*gio 19 git version-control github
我在我的笔记本电脑上做了一个回购。它在 github.com 上有一个项目页面。
我现在在我的台式电脑上工作。我手动复制了一些文件,因为我认为我不需要 repo 中的每个文件(所以我没有将 repo 克隆到我的桌面上)。如何将桌面本地文件夹与现有存储库连接,以便我可以将桌面上的文件推送到存储库(桌面文件现在是这些文件的最新版本,因为我停止使用笔记本电脑工作)
Asi*_*aza 25
使用命令行将现有项目添加到 GitHub:
# Initialize the local directory as a Git repository.
git init
# Add files
git add .
# Commit your changes
git commit -m "First commit"
# Add remote origin
git remote add origin <Remote repository URL>
# <Remote repository URL> looks like: https://github.com/user/repo.git
# Verifies the new remote URL
git remote -v
# Push your changes
git push origin master
Run Code Online (Sandbox Code Playgroud)
第二种方式@evolutionxbox 建议您:
如果在任何情况下 git 拒绝你的推送你可以使用 git push origin master --force
更新(10-23-2020):请记住,自 2020 年 10 月 1 日起,Github 将默认存储库从master重命名为main https://github.com/github/renaming
| 归档时间: |
|
| 查看次数: |
20692 次 |
| 最近记录: |