Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
86956a3
add create-branch
coyotte508 Apr 30, 2025
b175cf4
add delete-branch
coyotte508 Apr 30, 2025
80faefb
cli file
coyotte508 Apr 30, 2025
c3cc59b
Merge remote-tracking branch 'origin/main' into cli
coyotte508 May 6, 2025
28f1050
document cli & name it to 'hfx'
coyotte508 May 6, 2025
e886d54
Update packages/hub/package.json
coyotte508 May 6, 2025
dda33e7
fix TS
coyotte508 May 6, 2025
0de8bea
switch back to hfx for now @julien-c, see slack
coyotte508 May 6, 2025
13569ac
fix repo param in url
coyotte508 May 6, 2025
618bbce
fixup! fix repo param in url
coyotte508 May 6, 2025
d982af9
hfjs
coyotte508 May 6, 2025
ef81d23
fixup! hfjs
coyotte508 May 6, 2025
f9a5747
doc
coyotte508 May 6, 2025
fa31248
remove all shorthands (except 'q')
coyotte508 May 6, 2025
3533e2e
Merge remote-tracking branch 'origin/main' into cli
coyotte508 May 6, 2025
0fa9af7
cli fixes
coyotte508 May 6, 2025
23498e0
cli fixes
coyotte508 May 6, 2025
f735cfa
fixup! cli fixes
coyotte508 May 6, 2025
f831b3c
add hidden hub-url CLI param
coyotte508 May 6, 2025
3aacda1
fix uploading to new rev not from empty
coyotte508 May 6, 2025
ec619f3
Merge remote-tracking branch 'origin/main' into cli
coyotte508 May 7, 2025
04d7fdd
Merge branch 'main' into cli
coyotte508 May 7, 2025
4aefa05
Also support pathInRepo positional arg
coyotte508 May 7, 2025
03e615d
Add create-branch to the cli
coyotte508 May 7, 2025
0dec5a0
token param too
coyotte508 May 7, 2025
3b84137
better usage text
coyotte508 May 7, 2025
43aae04
Add --force param to create-branch
coyotte508 May 7, 2025
e25930e
fixup! Add --force param to create-branch
coyotte508 May 7, 2025
be57754
more detailed usage
coyotte508 May 7, 2025
8f96728
update repo name description
coyotte508 May 7, 2025
0be6a40
add delete-branch and version commands
coyotte508 May 13, 2025
ea0e2bc
add repoExists function
coyotte508 May 13, 2025
f6e9893
create repo when it does not exist
coyotte508 May 13, 2025
4a8e319
Update default commit message
coyotte508 May 13, 2025
468dc2c
create-branch => branch create and delete-branch => branch delete
coyotte508 May 14, 2025
a597f08
fixup! create-branch => branch create and delete-branch => branch delete
coyotte508 May 14, 2025
e0ad6f3
also upgrade typescriptt dep of doc-internal
coyotte508 May 14, 2025
a4a5a8d
always display full stack trace
coyotte508 May 14, 2025
220dbec
Merge branch 'main' into cli
coyotte508 May 19, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions packages/hub/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,32 @@ for await (const fileInfo of hub.listFiles({repo})) {
await hub.deleteRepo({ repo, accessToken: "hf_..." });
```

## CLI usage

You can use `@huggingface/hub` in CLI mode to upload files and folders to your repo.

```console
npx @huggingface/hub upload coyotte508/test-model .
npx @huggingface/hub upload datasets/coyotte508/test-dataset .
# Same thing
npx @huggingface/hub upload --repo-type dataset coyotte508/test-dataset .
# Upload new data with 0 history in a separate branch
npx @huggingface/hub upload coyotte508/test-model . --revision release --empty

npx @huggingface/hub --help
npx @huggingface/hub upload --help
```

You can also instal globally with `npm install -g @huggingface/hub`. Then you can do:

```console
hfx upload coyotte508/test-model .
hfx upload --repo-type dataset coyotte508/test-dataset . --revision release --empty

hfx --help
hfx upload --help
```

## OAuth Login

It's possible to login using OAuth (["Sign in with HF"](https://huggingface.co/docs/hub/oauth)).
Expand Down
2 changes: 1 addition & 1 deletion packages/hub/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"face"
],
"bin": {
"@huggingface/hub": "./dist/cli.js"
"hfx": "./dist/cli.js"
},
"author": "Hugging Face",
"license": "MIT",
Expand Down
2 changes: 2 additions & 0 deletions packages/hub/src/lib/create-branch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ export async function createBranch(params: {
empty?: boolean;
/**
* Use this to overwrite the branch if it already exists.
*
* If you only specify `overwrite` and no `revision`/`empty`, and the branch already exists, it will be a no-op.
*/
overwrite?: boolean;
}): Promise<void> {
Expand Down
Loading