user1406716 user1406716 - 2 months ago 12
Git Question

How to add git(bitbucket) to existing source code folder?

Question: How can I add the contents of an existing folder to git version control?

The tutorial here covers the case of making a directory and then adding source contents to it. I have some source code in a folder that is path dependent and don't want to move it.

So, how can I just go into my folder and make it a repository?


Final working solution using @Arrigo response and @Samitha Chathuranga comment, I'll put all together to build a full response for this question:

  1. Suppose you have your project folder on PC;
  2. Create a new repository on bitbucket: enter image description here

  3. Press on I have an existing project: enter image description here

  4. Open Git Bash console and type command 1 from second picture(go to your project folder on your PC)

  5. Type command git init

  6. Type command git add --all

  7. Type command 2 from second picture

  8. Type command git commit -m "my first commit"

  9. Type command git push -u origin master

Note: if you get error unable to detect email or name, just type following commands after 5th step:

 git config --global "yourEmail"  #your email at Bitbucket
 git config --global "yourName"  #your name at Bitbucket