git – How to create a repository and copy your finished files there?

Question:

I decided to protect myself and upload the project to git, specifically to bitbucket. Git is installed, but previously only used "pull-push" .
There is a folder with a project that I need to drop, the manual says:

mkdir /path/to/your/project

Do I need to register the name of the folder or the full path to the folder? Or do I need something else?

Can use the instruction "I already have a project"?
If I drop my project, will I accidentally drop it into the account of the office in which I work?

Answer:

  1. create a new repo in bitbucket (probably already);
  2. copy its SSH URL – something like git@bitbucket.org:drtvader/superproject.git – make sure it's your name after the colon, not your office name;
  3. go to your project folder on your computer;
  4. git init initializes the git project;
  5. git add . will add to it all files and folders in the current directory and deeper;
  6. git commit -m "initial commit" – will commit them all;
  7. git remote add origin git@bitbucket.org:drtvader/superproject.git – insert the URL of your Bitbucket repo copied in step 2;
  8. git push origin master to git push origin master newly created commit to bitbucket.

Everything seems to be. You don't have branches and tags yet. You have already worked with BitBucket from this computer for your organization, so further notes are likely not useful:

A. you may need to answer yes when you first connect to BitBucket from your computer in step 8 with git push.. – when asked whether to trust such and such a certificate from such and such an IP address.

B. if you have not used git from this computer before, you will need to configure git – set your name in Latin letters and email – they will be indicated as the author of commits from this computer:

git config --global user.name Vassia Poupkin
git config --global user.email poupkin@mail.ru

C. maybe not all files you want to control with git – for example, configs with passwords – create a .gitignore file .gitignore and .gitignore their names there, one per line, so that git doesn't pay attention to them.

D. create a README.md file in the root of the project in Markdown with your project description, title and honorary copyrights – the contents of this file will be shown by BitBucket on your project page.

Scroll to Top