有文件时如何克隆 Bitbucket 存储库?

How to clone Bitbucket repository when you have files?

我有一个私有的 Bitbucket 存储库,我将其克隆到所有客户端计算机:这就是我将源代码和更新带到客户端计算机并在开发阶段对其中任何一个进行更改的方式。

最近,我在将存储库从 Bitbucket 克隆到其中一台客户端计算机时遇到了问题。这些问题与网络连接不佳有关。

我不得不打开 Bitbucket 并在另一台 PC 上使用 Download sources as ZIP,然后使用简单的 USB 闪存驱动器将其复制到客户端计算机。

现在,我有资源,但没有存储库。

如何使用 Git 从 Bitbucket 存储库克隆并仅检查我的源,而不是再次下载?

正在将当前代码转换到 git 存储库

cd <folder>
git init

#Add the remote url of your bitbucket repository
git remote add origin <bit bucket repository url>

#Check that its working
git fetch --all --prune

#push changes to bitbucket:
git add .
git commit -m "My message..."
git push origin <master or any other branch>

另一个选项:

克隆存储库然后添加代码

git clone <url>

# now copy all the files you need to the cloned folder

# stage your changes for commit
git add -A

# commit your changes
git commit -m "Message..."

# push changes tot he server