Yeldar Kurmangaliyev
Yeldar Kurmangaliyev

Reputation: 34189

How to clone Bitbucket repository when you have files?

I have a private Bitbucket repository, which I clone to all client machines: that's how I bring sources and updates to client machines, and make changes from any of them during development phase.

Recently, I had problems with cloning repository from Bitbucket to one of client machines. These problems were related to the poor network connection.

I had to open Bitbucket and use Download sources as ZIP on another PC, and then copy it to a client machine using a simple USB flash drive.

Now, I have sources, but not repository.

How can I use Git clone from Bitbucket repository and simply check my sources, but not download it again?

Upvotes: 2

Views: 81

Answers (1)

CodeWizard
CodeWizard

Reputation: 141946

Converting current code to git repository

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>

Another option:

Cloning the repository and then adding the code

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

Upvotes: 2

Related Questions