Is it possible to stop verify/download newer repo from internet, such as
test $ repo init -u git#1.1.1.1/test/iot_manifest.git
Get https://gerrit.googlesource.com/git-repo/clone.bundle
Get https://gerrit.googlesource.com/git-repo
remote: Counting objects: 1, done
remote: Finding sources: 100% (36/36)
...
You can't, the repo installed on your computer (the one in your $PATH) is not the full version of repo it is only a launcher.
From the repo documentation on source.android.com:
Repo comes in two parts: One is a launcher script you install, and it communicates with the second part, the full Repo tool included in a source code checkout.
When you run repo init for the first time it gets the full repo and store it in the .repo/repo directory. Every time you'll run repo init again in a brand new repository, the full repo will be downloaded again in .repo/repo.
One thing though you can stop getting the clone.bundle line with repo init --no-clone-bundle
Get repo from your own computer (without internet)
You can use a local version of repo, you need the internet at least to get the git-repo code once. After that you can use this version stored locally in place of the remote ones on Google server.
cd workspace
git clone https://gerrit.googlesource.com/git-repo
mkdir repo_init_no_internet && cd repo_init_no_internet
repo init --repo-url=/home/<user>/workspace/git-repo
Related
I have a VPS running a Node.js / React app.
I want to update the files in the vps each time I push data to the git(hub).
I found out, using this answer, that I can add some hooks in git, executing commands on "post-receive".
What I didn't quite understand :
Why did he init another git ? Couldn't he have done this in the .git directory and create the hooks/post-receive file?
Why git checkout -f ? If the goal is to update local files, so nodemon / create-react-app restarts the server / app, why not execute a git pull instead ?
Is there a better way of doing this ?
In the recommended answer there, nobody is using GitHub and there is no other Git repository yet. So the answer to your question:
Couldn't he have done this in the .git directory and create the hooks/post-receive file?
is: No, there was no .git directory in the first place. The target machine had nothing at all, no Git repository, no working tree, etc. The git init --bare created the Git repository (the ".git directory").
The git checkout -f is a poor-man's / low-quality implementation of push to deploy. A receiving repository is normally "bare", and this one is no exception.
why not execute a git pull instead ?
That would require creating a third Git repository. That would have been an option.
"Better" is in the eye of the beholder. There are many ways of doing this, each with its own pluses and minuses. See also Deploy a project using Git push, which notes that since Git 2.3, receive.denyCurrentBranch = updateInstead is available; it was not available prior to 2015 (and in 2015, many people had older versions of Git installed).
Note further that if you're using GitHub as a hosting system, this changes a number of variables. The questions and answers you and I have linked here are aimed at those not using GitHub.
We use the google git-repo tool (aosp repo) to manage a workspace of many git repositories. However, if you want to do a clean checkout that is exactly the same as the last workspace, using the command repo sync will pull in all the changes from remotes first.
How can you get the local repositories populated from only the local cache that is currently in the .repo/ directory?
You can use:
repo sync --local-only
From repo help:
$ repo help sync
[...]
-l, --local-only only update working tree, don't fetch
i'm trying to push a local project to a gitlab repository. I followed the usual commands provided with each new Project. Everything worked just fine until the last command; I acctually dicovered the local project is being pushed to a gitlab project that I actually deleted.
And each time I create a new project and try to push to it, the files are directed to the one I deleted but is somehow re-created with every push.
Any thoughts?
Try reading the following guide. Although is for github, is almost identical for gitlab. (understanding git is the key). I think you need to re-formulate your question better:
You have the following remote: origin with path https://<your-gitlab-project-repo-path>.git. Then locally, you run:
cd your-project
git init .
git remote add origin https://<your-gitlab-project-repo-path>.git
git add .
git commit -m "initial commit"
git push origin master
Done.
First off, forgive me if this is a duplicate question. I don't know anything but the basic terminology, and it's difficult to find an answer just using laymen's terms.
I made a project, and I made a repository on Github. I've been able to work with that and upload stuff to it for some time, on Windows. The Github Windows application is nice, but I wish there was a GUI for the Linux git.
I want to be able to download the source for this project, and be able to edit it on my Linux machine, and be able to do git commit -m 'durrhurr' and have it upload it to the master repository.
Forgive me if you've already done most of this:
The first step is to set up your ssh keys if you are trying to go through ssh, if you are going through https you can skip this step. Detailed instructions are provided at https://help.github.com/articles/generating-ssh-keys
The next step is to make a local clone of the repository. Using the command line it will be git clone <url> The url you should be able to find on your github page.
After that you should be able to commit and push over the command line using git commit -am "commit message" and git push
You can use SmartGit for a GUI for git on Linux: http://www.syntevo.com/smartgit/index.html
But learning git first on the command line is generally a good idea:
Below are some basic examples assuming you are only working from the master branch:
Example for starting a local repo based on what you have from github:
git clone https://github.com/sampson-chen/sack.git
To see the status of the repo, do:
git status
Example for syncing your local repo to more recent changes on github:
git pull
Example for adding new or modified files to a "stage" for commit
git add /path/file1 /path/file2
Think of the stage as the files that you explicitly tell git to keep track of for revision control. git will see the all the files in the repo (and changes to tracked files), but it will only do work on the files that you add to a stage to be committed.
Example for committing the files in your "stage"
git commit
Example for pushing your local repo (whatever you have committed to your local repo) to github
git push
What you need to do is clone your git repository. From terminal cd to the directory you want the project in and do
git clone https://github.com/[username]/[repository].git
Remember not to use sudo as you will mess up the remote permissions.
You then need to commit any changes locally, i.e your git commit -m and then you can do.
git push
This will update the remote repository.
Lastly if you need to update your local project cd to the required directory and then:
git pull
To start working on the project in linux, clone the repo to linux machine. Add the ssh public key to github. Add your username and email to git-config.
For GUI you can use gitg.
PS : Get used to git cli, It is worth to spend time on it.
Some info:
Running Apache 2.2.3 on CentOS 5.6 64bit (dunno if Apache version is relevant here)
Git is installed
It's a VPS, so I have all the access I need
I have an existing website (located at /home/username/public_html/) and a dev version of the site (at /home/username/dev/) both on the same machine.
I work directly on the dev version (actually working local, but using Sublime Text 2's SFTP plugin to automatically upload on save, so for all intents and purposes, I can be considered to be working directly on the files at /home/username/dev/).
What I would like to do is use Git to push changes from dev to live. Currently I am having to keep track of which files are edited and then FTP or copy them over manually. I want to be able to revert changes if something doesn't go right, things like that.
However, I have never used Git (or any kind of version control) before. I've been googling Git tutorials, but everything I have found assumes something different from my actual setup. The main thing is that most tutorials assume brand new projects. I am terrified of messing up my live site by trying to set up a repo for it.
Anyhow, my question: how can I use my existing folders to create a repo where I can push from /home/username/dev/ to /home/username/public_html/ (or pull vise versa)?
I ended up following this tutorial and it does exactly what I wanted.
Assuming that your live version came from some version of your dev version you could get everything into a git repository with
make a copy of your live code
$ cp -axf /home/username/public_html/ git_repo
putting everything in live under git version control
$ cd git_repo
$ git init
$ git add .
$ git commit -m 'Initial import from live version'
now copy over all files from the dev version and put them on a branch dev in git
$ rm *
$ cp /home/username/dev/* .
$ git checkout -b dev
$ git add .
$ git commit -m 'Initial import from dev version'
After that your live code will be on the master branch in the repository and the dev code in branch dev.
If when you are done you always put everything from dev to live, you could achieve this in git with merging your dev into your master branch (which holds your live code) when you are done.
Your live version could be a clone of that repository from the master branch, and deploying would be just a
$ git pull
there.