我正在尝试将存储库克隆到我当前的目录中.但是,当我使用此命令克隆它时:
git clone REPOURL .
Run Code Online (Sandbox Code Playgroud)
它说:
fatal: destination path '.' already exists and is not an empty directory.
Run Code Online (Sandbox Code Playgroud)
我克隆的文件夹已经存在,我只想添加我在git repo中的文件.
有什么方法可以做到这一点吗?
谢谢
Cod*_*ard 28
您不需要克隆存储库,您需要添加远程,然后将文件添加到存储库.
git init
git remote add origin <remote_url>
git fetch --all --prune
git checkout master
git add -A .
git commit -m "Adding my files..."
Run Code Online (Sandbox Code Playgroud)
您已经有一个远程存储库,并且您希望将文件添加到此存储库.
首先,你必须"告诉"git当前目录是一个git存储库
git init
然后你需要告诉git什么是远程存储库的url
git remote add origin <remote_url>
现在您需要获取远程存储库的内容(所有内容 - 分支,标签等) git fetch --all --prune
检查所需的分支(本例中为master)
git checkout <branch>
将新文件添加到当前 <branch> git add -A .
提交您的更改 git commit
将更改上载回远程存储库 git push origin <branch>
| 归档时间: |
|
| 查看次数: |
17140 次 |
| 最近记录: |