I have created a local project with Visual Studio Code that implements a local Git repository.
Then I have create a Git repository on Visual Studio Online and I want to push all my project files to the remote repository...
What is the correct procedure to do it?
My .git\config files at this moment look like this:
[core] repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true ignorecase = true precomposeunicode = true
To push the code to GitHub from Visual Studio Code, you will need to create a GitHub account and install the “Github Pull Requests and Issues” extension. Note: Before pushing the code from VS Code to GitHub, you need to ensure that all the files are in one folder, and you have to push your folder to Github.
Select one of your repositories, and then select the repository location, which must be a folder. Once you choose the folder, you click the Select Repository Location button. After this, we need to set the Git username and email address with the git config command on the terminal.
I assume you started to work in a directory and didn't use Git there. The following should work with Git Bash:
cd "path to your repository" git init git add . # If you want to commit everything. Otherwise use .gitconfig files git commit -m "initial commit" # If you change anything, you can add and commit again...
To add a remote, just do
git remote add origin https://... git remote show origin # If everything is ok, you will see your remote git push -u origin master # Assuming you are on the master branch.
The -u
sets an upstream reference and Git knows from where to fetch
/pull
and where to push
in the future.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With