How do you add a new file to the Git remote repository?

Experience Level: Junior
Tags: Git


To add a new file, to the remote repository, you first need to add it to index (staging area). Use git add . command for this.

Then you need to commit the change to your local repository. Use git commit -m "Change description" command for this.

Then you need to push commits from the local repository to the remote repository. Use git push command for this.

Related Git job interview questions
Git for beginners
Git for beginners

Are you learning Git? Try our test we designed to help you progress faster.

Test yourself