How do I import my project from GitHub?
Clone a public or private repository without exposing a token and verify the branch. The file manager offers a GitHub import.
The file manager offers a GitHub import. For a private repository, use a repository-restricted token and revoke it after import if possible.
Step-by-step procedure
-
Clean the repository
Remove .env, tokens, passwords and large files. Add them to the .gitignore.
-
Open Files
Click “GitHub”, then enter the repository URL, the branch and the target folder.
-
Authenticate a private repository
Use a GitHub token with minimal scope. Never paste it into a project file.
-
Install the dependencies
After the import, put the files at the root and restart: the platform installs the dependencies from package.json or requirements.txt at start.
-
Check startup
Check the entry file and read the console on first launch.
Before you start
The import downloads a copy of the repository into the bot files. It is not a permanent link: a new commit on GitHub only reaches the bot after a new import.
- The repository is under 512 MB: above that, the import is refused.
- package.json or requirements.txt and the main file are at the top level of the repository.
- For a private repository: a “fine-grained” GitHub token limited to that repository, with read-only “Contents” permission and nothing else.
Put the code at the root
The “Import from GitHub” window always creates a new folder, the “Target folder”, inside the open folder. By default it is named after the repository. If a folder with that name already exists, the import is refused with the message existe deja dans ce repertoire: choose another name or delete the old folder.
The platform looks for package.json, requirements.txt and the start file at the root of the bot files. After the import, open the new folder, select all of its content and use “Move” to the root. Without this move, no dependency is installed and the bot cannot find its entry point.
A branch URL such as https://github.com/owner/repository/tree/dev fills in the “Branch” field automatically. The token goes into “GitHub token (private repository)”: it is used for this import only and never saved, so you can revoke it as soon as the import is done.
Check that everything works
The “GitHub import complete” message shows the folder that was created. Once the files are at the root, restart the bot from the console: you should see the dependency installation, then the launched command and the login message of your code.
Frequently asked questions
What does “Repository or branch not found” mean?
GitHub cannot find the repository or the branch you entered. Check the spelling, the exact branch name (main or master) and, for a private repository, add a token: without one, a private repository is treated as if it did not exist.
Why “Invalid or expired GitHub token”?
The token expired, was revoked or was copied incorrectly. Create a new one in GitHub, “Settings”, “Developer settings”, “Personal access tokens”, limiting access to the repository you need and to a short lifetime.
GitHub refuses access although the token is valid, why?
The token has no access to this repository, because it is not in its list of allowed repositories, or the GitHub rate limit has been reached. Add the repository to the token, or wait a few minutes before running the import again.
How do I update the bot after a new commit?
Import the repository again into a new target folder, then move the changed files to the root, replacing the old ones. Keep the files the bot created itself, such as an SQLite database or a log folder, then restart.