Try it this way:
git init
- To start the local repository;
git remote add nome-repositorio-remoto end-repositorio-remoto
- To enter the address of the remote repository;
git push nome-repositorio nome-branch
- This will cause you to send a branch(name-branch) to your remote repository(origin).
Example:
$git init
$git remote add origin https://[email protected]/tonidev/bootstrap4.git
$git push origin master
EDIT 1: Local Repositories(Bare)
You may, for example, need authentication for read access or may require more server speed. For each of these choices, there is a recommended protocol. Github, for example, provides read access to public repositories via git protocol (lighter and faster). But for writing access from project commiters, it uses SSH (a bit heavier, but provides authentication). Another option is HTTP for reading, which makes it easy to traverse corporate firewalls.
Anyway, there are basically four options:
- Local mapping
- SSH
- Git’s own protocol
- HTTP
What you’ll choose (or whether you’ll choose a hybrid solution like Github) depends on your needs.
With the command git init --bare
you are creating a repository that is pushable. Generally Bare repositories are created on the server and are considered repositories for storage, in contrast to repositories that go on the developers' machines that would be the development repositories, created with the command git init
(without the --bare
).
Although GIT is a distributed versioning control system, it is very common to have a central repository that facilitates the exchange of information between developers, avoiding the need for developers' computers to communicate directly with each other.
What’s more, Bare repositories don’t have Working directory, making it impossible to edit and commit files in that repository.
But for your case:
creating repository structure on External HD
mkdir repositorios
cd repositorios
mkdir nome_projeto
cd nome_projeto
the command below creates a remote repository, must be run inside the External HD
git init --bare
creating local repository and uploading to remote
git init
make the initial commit "-a" will add all the files in the commit and "-m" allows you to add a comment to the commit.
git add .
git commit -a -m 'comentário'
recording the external hard drive address so you don’t have to keep typing forever
git remote add hdexterno /caminho-do-hdexterno/caminho-repositorio/caminho-projeto
#se precisar remover
git remote rm hdexterno
updating the external hard drive
git push hdexterno
to clone an external hard drive project on your machine
git clone /caminho-do-hdexterno/caminho-repositorio/caminho-projeto
taking news from external hard drive and updating on the machine
git pull hdexterno
Common bug you’re starting with. Make sure you’ve used
git init
and add the remote repositorygit remote add origin https://github.com/seu-usuario/repo
– Mauro Alexandre
but is local D: Tec Dev GIT_REPORTORIOS or C: Users Documents project I did not enter this tag. Due to this error?
– hyperpixel