N
N
Nina Fineberg2021-10-21 21:49:28
git
Nina Fineberg, 2021-10-21 21:49:28

What is the right way to create a git repo first, or first generate the files and then push to git?

Can you please tell me how to properly "deploy" a new project with git?
1. I create a repository (for example, in bitbucket) -> I clone it into my project folder (I don’t quite understand how, because we have a project hierarchy there, for example, “Farm” and there is my frontend folder) -> start the generation (npm or yarn ...) and then I connect the remote repository and commit and push it?
2. I generate the initial files (npm or yarn ...) -> connect the repo -> push it with forced.

Thanks in advance!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
G
GAG, 2021-10-21
@NinaFFF

It depends on how well you understand what should go into the remote repository and what should not.
If you're not very savvy, you might find it easier to use the help of the `.gitignore` web generator based on what your project will be written in. There are such generators in GitHub, GitLab, Gitea.
As an alternative, find the `.gitignore` template that suits your project type.
Creating `.gitignore` is an important step because otherwise, you run the risk of pushing a lot of rubbish like the contents of the 'node_modules' folder into the remote repository.
If you need to quickly start developing with git, then the easiest way is to do `git init` locally, get started, and then add the address of the remote repository via `git remote add`, which you can then change via `git remote set-url` .

A
Alexey Yarkov, 2021-10-21
@yarkov

As you wish

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question