无法在 vscode git 中提交更改

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

我是编程初学者,我正在用 VS Code 编写一个项目,并尝试提交新文件以与我的 github 同步。但目录中的 10,000 个文件正在向我写入 C:\Users\gerga.DESKTOP-BSQOQP7 。我尝试重新安装一切。如何让 git 同步我的文件夹中的文件而不是另一个文件夹中的文件

我尝试更改来自我的用户文件夹的 10,000 条评论的文件夹,我尝试克隆到桌面上的工作包。我尝试重新安装 git,但没有任何效果

git visual-studio-code
1个回答
0
投票

有两种方式与Github同步。

如果您在 Github 上创建了一个新存储库,并且本地没有任何现有代码,只需从 Github 获取 https 代码将其克隆到本地即可。

如果您的机器中已经有代码,正如我读到的那样,您应该在 Github 上创建一个存储库(您已经这样做了),现在您应该同步它们。如果您在没有自述文件的情况下在 Github 上创建新的存储库,Github 会说:

…or create a new repository on the command line
echo "# testtest" >> README.md
git init
git add README.md
git commit -m "first commit"
git branch -M main
git remote add origin https://github.com/USERNAME/REPONAME.git
git push -u origin main
…or push an existing repository from the command line
git remote add origin https://github.com/USERNAME/REPONAME.git
git branch -M main
git push -u origin main
…or import code from another repository
You can initialize this repository with code from a Subversion, Mercurial, or TFS project.

这意味着你需要定义你的远程,将分支更改为主分支(Github默认有主分支)并推送到Github。

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