Please note that I read most of the suggestion o this page, but there are too many suggestions and I cannot find a proper way for my problem.
I created a new repository called demo-project
on GitHub and I want to push demo-project
that already on my local disk on D:\projects
folder. I cloned the repo to D:\projects
directory (first I move my project to another location) and then copied my project to that D:\projects
folder. Then I connect to GitGub, but it shows lots of changes that I did not make and after pushing the changes to the GitHub, it uses my work account instead of private GitHub.
So;
1. How should I push my changes to the repo on GitHub? Should I first clone that repo and then copy my project to the clone directory (D:\projects
)? Or is there an easier way e.g. connecting to repo and then push?
2. How can I use my private GitHub account automatically for this repo when I run commends when I am in this repository (D:\projects\demo-project
) on cmd? Should I run the following command for setting my private repo without --global
option?
git config user.name "[name]"
git config user.email "[email]"
git config user.password "[password]"
CodePudding user response:
First you would need to perform this command :
git init
then :
git remote add origin REPO_LINK
REPO_LINK being the link to your repository.
So this command will, "link" your folder to the repository, so when you will commit any changes, it will push the code from the remote (the folder you added the remote to) to the repository.
Edit : It should fix your "Fatal : Not a git repository" error.