I playing around JGit, I could successfully remove a remote from some repository (git remote rm origin), how can I do a git remote add origin http://github.com/user/repo ? To remove I do the following: StoredConfig config = git.getRepository().getConfig(); config.unsetSection(“remote”, “origin”); config.save(); But there’s no a option like #setSection(String, String). Thanks in advance.
I work on Linux all the time and I’m clueless about Windows, not even having a Windows box. Is Git nowadays working on Windows? Or am I making problems for my Windows pals by using it?
“Traditional” version control systems follow a “Cathedral” model — all the code is stored in one main repository. Distributed Version Control Systems like git allow a lot more flexibility in organizing your multiple repositories. You can “push” changes, “pull” changes, and “clone” repositories. Have you organized your repositories along your workgroup or workflow lines? Have […]
When attempting to Push via Source Tree, I get the following error: git -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree push -v –tags origin refs/heads/master:refs/heads/master Pushing to https://email@example.com/repo.git To https://firstname.lastname@example.org/repo.git = [up to date] master -> master … ! [rejected] example_tag -> example_tag (already exists) updating local tracking ref ‘refs/remotes/origin/master’ error: failed to push some refs […]
The following commands $ git co -b newbranch $ git co oldbranch result in “fatal: cannot exec ‘git-co’: Permission denied” error. In the same time, $ git checkout -b newbranch $ git checkout oldbranch and $ sudo git co -b newbranch $ sudo git co oldbranch work as expected. Ownership rights for the .git folder […]
I have a file which ended up being versioned in our repository but shouldn’t have been. For arguments sake, the file is config.py. We instead version config.py.tpl but never the actual production config for the obvious reasons. What’s the right way to stop versioning this file without deleting it locally from the working directory? Also […]
I was following this guide here on how to add Git to my Path variable so I can use it from the command line (Not just Git Bash). Installing Git in PATH with GitHub client for Windows To quote an answer, Git was supposedly located here Get the Git URL We need to get the […]
I am using git for source control on a repository. Recently it has begun warning me about how long it takes to enumerate untracked files when using git status: $ git status On branch my_branch Changes not staged for commit: (use “git add <file>…” to update what will be committed) (use “git checkout — <file>…” […]
Initially I had the following (simplified) repo structure: MyRepo external1/MySub (git submodule) .gitsubmodules Where $ cat .gitsubmodules [submodule “external1/MySub”] path = external1/MySub url = user@repo:/remoterepo/externals/MySub.git I then wanted to move MySubmodule to another directory in the same git repository, e.g., external2 so the structure is as follows: MyRepo external2/MySub (git submodule) .gitsubmodules What I did, […]
Alright, lets say one day we make happen to make a bunch of modifications and when we go to commit them we notice we were working on the wrong branch. How can we force git to switch branches without discarding local changes. I’m probably going to go about this in a naive way while I […]