git command in the terminal. Commits, staging, branches, and diffs work offline. Cloning, pulling, and pushing need an internet connection.
Before you begin
- To use Git on your own projects: nothing extra.
- To clone private repositories or push to GitHub: sign in to Lectra, and then connect your GitHub account, as described in Connect GitHub.
- Remotes must use HTTPS: addresses that start with
https://. SSH addresses, such asgit@github.com:…, aren’t supported.
Connect GitHub
Lectra uses your GitHub access to list your repositories, clone private ones, and push. You need to be signed in to Lectra first. You can connect from either of these places:- The Clone a Repo sheet: in your library, tap Projects > New > Clone a Repo.
- The terminal: tap Connect GitHub in the terminal’s header.
- Sign in with GitHub
- Use a personal access token
Tap Connect with GitHub, sign in to GitHub, and allow access. When you return to Lectra, your repositories load.
Lectra uses your GitHub access only for repositories on github.com. You can clone public repositories from other sites with
git clone in the terminal, but you can’t push to them.Clone a repository
- From your GitHub list
- With the terminal
1
Open Clone a Repo
In your library, tap Projects > New > Clone a Repo.
2
Pick a repository
After Loading your repositories…, tap a repository in the list. A lock marks private ones.
3
Open it
When cloning finishes, the repository appears in the Projects tab. Tap it to open it in the code editor.
git clone in the terminal.Set your name for commits
Each commit records who made it. Unless you set your name, Lectra records commits as “Lectra”. To use your own name and email, open the project’s terminal and type:git config --global.
Commit changes in the code editor
1
Open Source Control
In an open project, tap Source Control (the branch button) in the top bar, or press Control Shift G.
2
Start tracking, if needed
If the panel says Not tracked yet, tap Start Version Control. Lectra starts keeping a history of the project.
3
Review your changes
Changed files are listed under Changes. Tap a file to see what changed in it.
4
Stage files
Tap + (Stage) next to each file you want to include. It moves to Staged Changes. Tap − (Unstage) to take it back out.
5
Commit
Type a description in Commit message, and then tap Commit followed by the number of files. When nothing is left to commit, the panel says Working tree clean.
git switch -c branch-name in the terminal.
Sync with GitHub
Sync to GitHub saves your work to GitHub in one step. It commits every change in the project, gets any new changes from GitHub, and then pushes.1
Open the project
Open a project that you cloned from GitHub.
2
Tap Sync to GitHub
Tap Sync to GitHub (the circular arrows) in the top bar. You can also choose Sync with GitHub in the command palette.
3
Check the result
Lectra shows Synced when it’s done, or Couldn’t Sync with the reason.
git status to see the conflicting files, fix them, and then sync again.
Use Git in the terminal
The terminal’sgit command supports these subcommands:
To learn more about the terminal, see Use the terminal.
Limits
- Remotes must use HTTPS. SSH remotes aren’t supported.
rebase,stash,merge, submodules, and Git LFS aren’t available.git pullin the terminal works only when it doesn’t need to merge. Sync to GitHub can merge.- Settings apply to one repository at a time.
--globaland--systemaren’t supported. - Lectra can push only to github.com.
- The Source Control panel commits and switches branches. To pull or push, use Sync to GitHub or the terminal.
ssh from the terminal. To learn how, see Use the terminal.
Troubleshooting
“Sign in to Lectra first, then connect GitHub.”
“Sign in to Lectra first, then connect GitHub.”
Connecting GitHub needs a Lectra account. Sign in to Lectra, and then connect GitHub again.
“SSH Git remotes are not supported”
“SSH Git remotes are not supported”
Use the repository’s HTTPS address instead. To change an existing remote, type
git remote set-url origin https://github.com/username/repository.git.“This project has no 'origin' remote to sync with”
“This project has no 'origin' remote to sync with”
Sync to GitHub needs a remote named
origin. In the project’s terminal, type git remote add origin followed by the repository’s HTTPS address.Push or clone fails for a private repository
Push or clone fails for a private repository
Make sure GitHub is connected. The terminal’s header shows GitHub with a green dot when it is. If you use a personal access token, check that it can access the repository.
“git … is not supported by Lectra's local Git runtime yet”
“git … is not supported by Lectra's local Git runtime yet”
That Git command isn’t available on the iPad. Check Limits for alternatives.
Related
Use the code editor
Edit project files and use Source Control.
Use the terminal
Run
git and other commands.