Good day! Learning to use git when developing projects. As the manual says there are 2 ways to create a git repository.
Create an empty repository on github.com and then execute the commands:
cd "папка на хостинге куда мы хотим разместить git репозиторий" git clone "адрес репозитория на github.com"There are no problems with this method, but sometimes you need to create a repository with existing source code. That is, I lived the code, and then we decided to work on it with a team, we should put it in git.
We fall into the folder with the code on the hosting and execute a number of commands:
git init- initialize the git repositorygit add .- we index files in a directory (the starting point from where git will start tracking changes)git commit -m "Комментарий к коммиту"- Make a commit of previously collected (indexed) filesgit remote add origin https://github.com/ИМЯ_ПОЛЬЗОВАТЕЛЯ/НАЗВАНИЕ_ПРОЕКТА.git- as I understand it, we create a repository on github.comgit push -u origin master- well, finally send our files to github.com
Next, the system asks to specify the username and password of the user https://github.com/NAME_ENER .
And I got this error:
error: The requested URL returned error: 403 while accessing
https://github.com/maler1988/testgit.git/info/refs
fatal: HTTP request failed
Following the link https://github.com/maler1988/testgit.git/info/refs I found an article that says that git stopped accepting such commands via HTTP protocol (if I understood everything correctly, of course). In foreign forums it is advised to use SSH, then creating a remote repository will look like this:
git remote set-url origin git@github.com:maler1988/testgit.git but it does not say how to send files to the repository later. The git push command does not work, writes an error and asks to use the link to the repository for git push HTTPS:
You can't push to git: //github.com/maler1988/testgit.git
In general, I am confused in this method. Unravel me, please!