0

i'm trying to upload files with GitHub CLI but i'm enable to know tasks i have to perform

i can upload with git CLI (before i created the Github repo manually with webbrowser)

git init <myRepo> // create a local repo
cd <myRepo>
// writing README file for a test
git add README // to mark this file for next upload
git commit -m "msg for the test"
git remote add origin https://github.com/MYUSER/MYREPO.git
git push origin master // main does not work

it's okay with this, but using Github CLI... i'm not able to find steps and/or commands.

english is not my natural language, i'm a newbie with Github (so i don't know what is the meaning for words like pull, pull request, or others) and i did not see a step by step inside official website

when i create a Github repo with

gh repo create MYREPO --public

it does not create the same folder inside my local computer.

it does not create the .git folder inside MYREPO

do i need to perform more than gh release create MYREPO MYFILE?

any help please?

redrabbit
  • 41
  • 5
  • The `gh` command is not *supposed* to create the folder locally. It merely sends requests to GitHub to operate on repositories over on GitHub. The local Git folder, created by `git clone`, is local to your machine, and is not operated-on by `gh` (at least not for `gh repo create`). – torek Oct 04 '22 at 16:12
  • ok, here my understanding about your comment. 01, i use "gh repo create --public" to create a github repo into my github account from my terminal gh CLI. 02, i use the git command "git init to create a local folder as local git repo. after... how to upload files from local Github repo to online Github repo.With git commands, i know terminal commands (i posted into my question) but with GitHub CLI what are the commands (or steps)? Do i need mix git and gh commands? – redrabbit Oct 05 '22 at 13:39
  • @ambergupta09, hi, was not the question but thks for the command – redrabbit Oct 05 '22 at 13:41
  • I have not used the `gh` program much and wasn't aware of the `--clone` option, which might be handy for some cases. In general though you'll want to use `git ` locally and `gh ` to manipulate the GitHub side of things, while keeping in mind that the GitHub repository is on GitHub and is a *different repository* than your local repository on your laptop. Also, GitHub issues and PRs and the like are stored in a database that only exists on GitHub: there is nothing in your local clone that corresponds to these. – torek Oct 05 '22 at 15:46

1 Answers1

0

To create a remote repo and clone it locally, you need to run: gh repo create my-project --public --clone

Currently, you are just creating a remote repo. If you already have a repo with same name on local, it will raise error while creating new one on local machine.

ambergupta09
  • 162
  • 2
  • 11