Install Git Client on OS X without admin rights - macos

I need to run a git client on an OS X 10.6.6 machine to which I don't have admin rights.
Now unfortunately, the installer from http://code.google.com/p/git-osx-installer/ has no option for a local install, so it just doesn't work without having an admin account.
What is the fastest / easiest way to install git, e.g. in ~/bin ?
Note: While I can download zip archives from GitHub (from which my projects come), I need to be able to quickly pull new commits, so this is not an option.
Fink has no binary for OS X 10.6, and the MacPorts installer doesn't work either without admin rights.

Download Git source code and compile.
./configure --prefix=$HOME/local
make
make install
Edit .bashrc or whatever to change PATH.
PATH=$HOME/local/bin:$PATH

I'd use homebrew to install git as a local user. That's a whole lot easier to update and gives you the chance to use the whole infrastructure to install even more goodies.
https://github.com/mxcl/homebrew

Related

How do I install Git for Windows software to a specific directory?

I have just downloaded the latest Git for Windows installer, v2.4. It appears to want to install to the standard Windows "Program files" (with-spaces-in-name) directory.
Since I have all my development code in a folder called (simply) "/bin" -- I want to see if there's a command line option or parameter to change the install directory.
In my case, these days I use a environment variable such as GIT_HOME for important software like git; so it would be useful if there was a way to apply that to things like git commands, etc once I have the program installed.
possibly related:
How do I change the directory in Git Bash with Git for Windows?
I also came across a few questions asking: "whereis git". That's answered above, however I take that as an indicator that others may want git somewhere else too.
To start the installer with a different installation path you can open a CMD terminal in the same directory as the installer executable and pass in an option parameter of /DIR="x:\dirname"
For instance, if you have version 2.17.0 for Windows 64bit and you want to install git to D:\git, you would run:
Git-2.17.0-64-bit.exe /DIR="D:\git"
The installer will launch as usual and you need to walk through the other options, but the install location will be the path specified.
Since I just ran into this problem because my SSD is filling up, I figured I'd share the solution I came to on Windows 11 with Git v. 2.37.2.
The best way I could figure was to uninstall Git, then in CMD Prompt use the suggested command from the Git website with an appended --location/ -l flag:
winget install --id Git.Git -e --source winget --location [drive:/directory]
where [drive:/directory] is your target for the install. Had no issues and verified it worked with a project.

Macports' dropping of privileges causing Xcode licence problems

I am trying to install some ports using Macports on OS X but as soon as the installation tries to invoke the C compiler I get:
Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.
Context:
I have run sudo xcodebuild -license and successfully agreed to the
licence however when I run xcodebuild -license I get the same error
as above.
I am running Macports in sudo: sudo port install ghostscript but
Macports seems to drop the privileges during the installation. (Also tried using the terminal as root user but that didn't seem to help either.)
Therefore, I am seeing two options: either managing to somehow agree to the licence at my user level, or forcing Macports to retain the privileges. But so far didn't manage to do any of these.
License acceptance is stored in
/Library/Preferences/com.apple.dt.Xcode.plist,
~/Library/Preferences/com.apple.dt.Xcode.plist (MacPorts copies this file from your home on startup to support older Xcode releases that required per-user acceptance), or
~macports/Library/Preferences/com.apple.dt.Xcode.plist
Try moving these files aside if they exist and re-do the license acceptance using sudo xcodebuild -license. Try also cleaning out /var/folders/zz, the Xcode command line tools use this to cache some data that may cause this problem. If that doesn't help, check file permissions on these files (at least the first one should be -rw-r--r--, i.e. readable by everyone).
There is a way to make MacPorts build as root rather than dropping privileges, but you shouldn't do that unless absolutely necessary. The privilege separation is a safety feature to avoid misbehaving ports from wreaking havoc on your system.

sudo command not found on Cygwin

I am currently trying to install and update a few packages on a Windows OS. The only matter is that I am using Cygwin in order to type the commands through a terminal (as I'm aware, I can type in Linux type commands such as cd, ls etc. on Cygwin - I may be wrong). However, when I try to install a package like:
sudo apt-get install paparazzi-dev
I get the reply:
-sh: sudo: command not found.
Does anyone have an idea as to how I can fix this problem?
Run cygwin as administrator.. then you wouldn't need any sudo command.
Cygwin is not a full Linux distribution. Therefore you don't have sudo or the Debian/Ubuntu package manager apt-get. There is a number of packages available from the Cygwin repository: http://cygwin.com/packages/
You have to chose these packages during setup.
Windows does not have sudo, apt, or almost any Linux commands to be exact. Cygwin may allow some, but as programs are not installed on Windows as packages apt-get will not work. Windows programs have installers as .exe or .msi instead.
The Windows version of sudo is called runas in case you need to run something as another user. Or, you can run Cygwin as administrator.
If you have to use the packages you need Linux. You can install it directly to replace Windows, dual-boot or use a virtualization software like VMware VirtualBox.
Making out an explanatory answer from answer here by #Aimal as it worked for me.
Cygwin may not get permissions to create folders and files when run by clicking Cygwin icon that's in normal mode.
Cygwin gets the right authorization only when right click -> "run as adminitrator" on cygwin icon because of that it gets permissions to create folders and files.
Cygwin lets you run certain commands, such as cd, ls, or mv; but it doesn't let you run other commands, such as sudo or apt-get.
If you're trying to add a package to your Cygwin installation, rerun Cygwin Setup. It may still be in your "Downloads" folder. Go through all the steps again. The Cygwin installer will automatically download and install the package you want, and add it to your Cygwin installation. (I think it will probably also upgrade all your other installed Cygwin packages to the latest available versions.)
If your desired package isn't on the Cygwin package list but is on the Cygwin Ports package list, follow the Cygwin Ports installation instructions. Note that Cygwin Ports is separate from Cygwin. Please do not send messages about Cygwin Ports packages to the cygwin.com mailing lists.
If you have years of Linux experience, you may be able to compile the software you want inside Cygwin. This can be challenging.
Perhaps an option simpler than "compile it yourself" is this: You can install VirtualBox, then install your favorite Linux distribution inside the virtual machine, then install your desired package inside Linux. (I like Ubuntu Linux, which has more than 27,000 packages in its "Universe" repository.) Now you can run Linux and Windows at the same time.
I think I tried steps below after doing some research & succeeded (on windows)
1.Install scoop using powershell 3 (iex (new-object net.webclient).downloadstring('https://get.scoop.sh'))
2. do scoop install --global sudo
3. make sure paths (C:\Users\\scoop\shims & C:\ProgramData\scoop\shims) added in environmental path variable.
In my case, I wanted to install curl, but could not create directory /usr/local/curl/lib when running command "make install", because of permission deny. so i need to change /usr/local permission. when i run sudo chmod 755 /usr/local, sudo command not found.
after searching a few solution, found that sudo is not installed by default in Cygwin. But I tried the solution that Aimal gave which is to run Cygwin as administrator. I finally can change the folder permission. Thanks Aimal.

Installed git 1.8.4.2 on Mac, but git --version reports 1.8.3.4

I downloaded the latest version of git - 1.8.4.2 - from git-scm.com/download/mac
After I installed it, if I enter git --version in a terminal window, the version is reported as 1.8.3.4.
I ran the uninstall script for both version, but git continues to report 1.8.3.4 on my system.
I'd like to:
Delete git entirely from my system and
install the latest version from the URL above.
Can someone let me know the best way to do this?
Rather than removing system binaries (why would you want to do that?) you should do one of two things:
Check your $PATH and ensure that things you install have a higher position in the $PATH than the system defaults,
Move /usr/bin/git to /usr/bin/git-1.8.3.4, then symlink the one from /usr/local/bin to /usr/bin/git.
Both of these will allow you to keep both versions in such a way you can choose which to run (providing full path, for example), while also making the most recent install the default.
As an aside, if you've installed from source yourself, I'd recommend building the binary with the version number either in the path or in the binary name (/usr/local/git/1.8.4.2/bin). If you're aiming to keep git up-to-date, this will probably save you some hassle down the track when you're installing for the nth time.
If you're on a mac, check out homebrew, too - the latest git is 1.8.4.3, so it appears up-to-date.

Install Git separately from Xcode

Firstly apologies if this is a really simple question but Git is absolutely brand new to me. Basically I've been dabbling with a bit of iOS development for a little while and now have a project idea that I want to start working on and for the first time I'm planning on putting this into source control.
Now I know Xcode 4 has some Git integration but I've spotted a couple of posts that suggest the integration isn't that great and it's better to do it the command line way.
So, I've been following instructions here http://git-scm.com/book/en/Getting-Started-Installing-Git and I've downloaded version 1.7.10.3 for Mac and ran the install.
However when I run git --version I get version 1.7.4.4 which is the version that was installed with Xcode I assume?
My question is, how do I make use of my new version 1.7.10.3? The plan is to learn to use Git via command tools and set up a central repository on a server I have at home, then have local copies on my laptop.
As I say I'm really new to this, so a quick step by step idiots guide would be helpful. I have searched and tried to find details here and on google but other than the suggestion to use Git outside of Xcode I've not found out exactly how to do it.
Any advice, or links to a decent tutorial that covers this would be very much appreciated.
Update:
I've changed the path to the new path in .bash_profile (/usr/local/git/bin) and now get git version 1.7.7.5 (Apple Git-26). This still appears to be the wrong version (although this could be me being dense). I downloaded the installer for OSX from the above link. Should I be doing something else. I want to play around with the command line tools so I can get a proper understanding
Update 2:
I'm now also trying MacPorts as recommended in the article. This seems to be downloading a lot more than just Git though
Xcode installs git in /Applications/Xcode.app/... but if you run 'Install Command Tools' then git gets installed also in /usr/bin/git. Xcode uses its private version in Xcode.app. If you installed git in /usr/local/git/bin then you need to include that directory in your PATH. You should have a .bashrc file (or equivalent for whatever shell you are using). Add
PATH=/usr/local/git/bin:$PATH # your shell might use different syntax.
to that file 'rc' file.
Also, note that Xcode would allow you to accomplish your goal of setting up a remote at home while maintaining a local copy on your laptop. Go to the Xcode 'organizer' and click 'repositories'. There you will find all your machine's Git repositories. Choose one, select the 'remotes' folder and then '+' to add your home remote. I use Xcode this way.
Credits goes to #GoZoner for the answer. I'm just summing up everything.
Download official git installer from : http://git-scm.com/download/mac
Install and add its directory to your path :
echo "PATH=/usr/local/git/bin:\$PATH" >> ~/.bash_profile
source ~/.bash_profile
The best way is:
step 1:
Install homebrew on your mac this is the official website Homebrew homepage
From a Terminal prompt:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
step 2:
From a terminal prompt
brew install git

Resources