-1

How to push a code from my local env to a brand new repository that does not have any branch yet.

2
  • 1
    I'm not sure what you are asking. Are you asking how to add a new remote to your repository? Or are you asking if git push can be used to push to a remote repository directly? Commented May 12, 2022 at 18:58
  • the second option. Git push to a remote repository directly. Commented May 12, 2022 at 19:36

1 Answer 1

0

The syntax of git push is:

git push [options] [ […​]]

Repository can be a URL to a repository or the name of a configured remote in your repo.

To push local branch "a" to a repository at example.com/repo.git, execute

git push example.com/repo.git a

If you plan on doing that more than once, consider adding a remote:

git remote add examplerepo example.com/repo.git
git push examplerepo a
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.