I'm using the github cli (GH), and I have an already created repo, and a local git repo, is there a way to add a remote repo for that git repo using the gh cli?
how to add a remote repo using gh cli?
Asked Answered
It appears that the CLI doesn't have a command to create it directly, but it's possible to do it with the repo view
command:
git remote add origin $(gh repo view $repo --json sshUrl --jq .sshUrl)
This looks great. If you have a link to documentation supporting your answer, adding that you your post as an edit would be an excellent upgrade to your answer. This would increase the likelihood visitors will follow up to learn about this feature, and help users out so everyone doesn't have to try running the same searches for it. Adding a supporting link could even garner a few additional upvotes from users. Either way, thanks for your solution! –
Psychodrama
you can try this steps
curl -u 'nyeates' https://api.github.com/user/repos -d '{"name":"projectname","description":"This project is a test"}'
git remote add origin [email protected]:nyeates/projectname.git
git push origin master
maybe you can find the other reference in here : Is it possible to create a remote repo on GitHub from the CLI without opening browser?
© 2022 - 2024 — McMap. All rights reserved.