2

I'm trying to create a workflow where I create my local project, automatically create the remote bitbucket repo based on the project name, then clone that repo into the local folder I'm working from. The problem is, you can't clone into a folder with files. The workaround so far is to clone into a folder, then move the contents into my working directory.

This is what I have so far that's not working:

git clone https://U:[email protected]/user-account/{project_name}.git &  mv {project_path}/{project_name}/.git {project_path}/../../
1
  • Why are you doing this? I am not understanding from your description of the question why you would want to do this.
    – Ryan Bigg
    Commented Nov 1, 2012 at 5:16

2 Answers 2

1

A few problems:

  • Multiple interdependent commands should be delimited with &&, not &
  • You're cloning to the current directory, but moving from under {project_path}/
  • You're moving to {project_path}/../../, which is two directories up from where {project_path} is. Is this correct?

This should achieve what is probably your intention: (Getting a .git that's linked to bitbucket into your local folder.)

git clone https://U:[email protected]/user-account/{project_name}.git --no-checkout tmp
mv tmp/.git {path_to_your_local_folder}/
rmdir tmp
2
  • to clarify I have a config folder so the project path goes to that directory
    – drrobotnik
    Commented Nov 1, 2012 at 16:13
  • Accidently hit enter... To clarify I had a config folder in the project root, so from that folder I was cloning, so I had to move the .git file up 2 directories. After adding && worked perfect!
    – drrobotnik
    Commented Nov 1, 2012 at 16:19
0

How do you "automatically make a bitbucket repository"?

The normal workflow is to make a bitbucket repository through their site. Now you can do the rest of the steps without a clone.

git init
cat > .gitignore # add the patterns you don't want tracked
git add -A
git commit -m "initial commit"
git remote add origin <the url to your bitbucket repo>
git push origin master

Not the answer you're looking for? Browse other questions tagged or ask your own question.