1

I have a project in VS Code. I want to have it automatically synced with my Github. How can I accomplish this with a series of git commands from the command line?

I think the first one is

git init 

but that does not fully accomplish the job. What are the other commands I need to do?

1

1 Answer 1

3

git init will initialize a new local git repository in your project folder. If you have a remote repository (at GitHub) and want to work with its content in your computer, you have to use the command git clone <url_of_the_github_repository_extension_dot_git>.

ie: git clone https://github.com/username/repo_name.git

After clone the remote repository into your computer, you will have a local repository connected with the remote cloned repository and then you can start to change the local repository and push your changes to the remote repository.

To save your changes in you local repository you can use the script below:

git add . git commit -m "a message to describe your commit" 

To send the changes saved locally to your remote repository you need to execute the command below:

git push origin master 

This is the simplest flow to work with a remote GitHub repo in your computer.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.