When I go to Mac Terminal and execute my sh file with the following command set included, it runs smoothly. When I. allow my crop tab to execute evert hour between 9 am to 18 pm, it says the following exceptions
Fetching origin
hint: Pulling without specifying how to reconcile divergent branches is
hint: discouraged. You can squelch this message by running one of the following
hint: commands sometime before your next pull:
hint:
hint: git config pull.rebase false # merge (the default strategy)
hint: git config pull.rebase true # rebase
hint: git config pull.ff only # fast-forward only
hint:
hint: You can replace "git config" with "git config --global" to set a default
hint: preference for all repositories. You can also pass --rebase, --no-rebase,
hint: or --ff-only on the command line to override the configured default per
hint: invocation.
Already up to date.
Already on 'feature/sprint_1'
M src/Podfile.lock
M src/MyProject/Info.plist
Your branch is up to date with 'origin/feature/sprint_7'.
bundler: command not found: fastlane
Install missing gem executables with `bundle install`
At my project folder structure, Gemfile and Gemfile.lock exists. Do I need to ..
modify Gemfile before executing my command set?
execute my command with superuser sudo access?
Given bundles and fastlane properly installed, How could I acknowledge my file path to execute is correct?
4.The below is my .sh file with following command set: Should I need to modify my command set also?
cd ~/myProject/src && git stash clear && git fetch --all && git pull && git checkout $1 && bundle exec fastlane ios build build_type:adhoc build_env:dev
Where $1 is my proposed branch e.g. master, release , feature/sprint_1
According to the last 3 rows of your logs which are:
Your branch is up to date with 'origin/feature/sprint_7'.
bundler: command not found: fastlane
Install missing gem executables with `bundle install`
and your script has cd, and 4 git commands at the beginning. I will assume $1 is master. It is basically like this:
cd ~/myProject/src
git stash clear
git fetch --all
git pull
git checkout master # or $1
bundle exec fastlane ios build build_type:adhoc build_env:dev
Bundler says command not found: fastlane and then it shows the solution which is that you need to run bundle install.
Probably when you add bundle install before bundle exec you will resolve your problem:
cd ~/myProject/src
git stash clear
git fetch --all
git pull
git checkout master # or $1
bundle install
bundle exec fastlane ios build build_type:adhoc build_env:dev
Related
I try to update Homebrew as usual. Recently when I issue the command brew update, the following error occurs:
Error: Fetching /usr/local/Homebrew/Library/Taps/facebook/homebrew-fb failed!
The Tap is associated with the software Buck, which I need for development.
I further investigate the issue by following the installation instruction in the Buck official website, I issue the command again:
% brew tap facebook/fb
==> Unshallowing facebook/fb
fatal: couldn't find remote ref refs/heads/master
Error: Failure while executing; `git fetch --unshallow` exited with 128.
Apparently, the Git source has problems. I try to "untap" it:
% brew untap facebook/fb
Error: Refusing to untap facebook/fb because it contains the following installed formulae or casks:
buck
No luck. How can I resolve this problem?
This error is the result of Facebook renaming the branch master to main.
To fix this, first change into Homebrew's local tap folder:
cd /usr/local/Homebrew/Library/Taps/facebook/homebrew-fb
Then, run the following Git commands to update the local repo:
git branch --unset-upstream
git config remote.origin.fetch '+refs/heads/main:refs/remotes/origin/main'
git fetch --prune origin
git branch -m main
git branch -u origin/main
git remote set-head origin -a
Finally, remove the no longer needed master ref (optional):
rm .git/refs/remotes/origin/master
That's it, you should now be able to successfully run brew update.
I am trying to add an existing project to GitHub using the command line. I am in the relevant working directory in the terminal and am trying to use the git init -b main command.
Initially, I was getting an error relating to xcode:
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
I tried xcode-select --install but the software was unavailable from the update server, so I downloaded 'Command Line Tools for Xcode 12' from https://developer.apple.com/download/more/.
Now on entering git init -b main I am getting the following:
error: unknown switch `b'
usage: git init [-q | --quiet] [--bare] [--template=<template-directory>] [--shared[=<permissions>]] [<directory>]
--template <template-directory>
directory from which templates will be used
--bare create a bare repository
--shared[=<permissions>]
specify that the git repository is to be shared amongst several users
-q, --quiet be quiet
--separate-git-dir <gitdir>
separate git dir from working tree
I am running git version: 2.24.3 (Apple Git-128)
Any help much appreciated!
The -b flag is only available in version 2.28 or later, you need to upgrade your Git.
On debian-based Linux systems such as Ubuntu, do the following:
sudo add-apt-repository -y ppa:git-core/ppa
sudo apt update
sudo apt install git -y
git 2.24 doesn't have option -b/--initial-branch. It was added in git 2.28. You need to upgrade to use the option.
Or, as #matt said, create a repo and then rename the branch:
git init repo
cd repo
git branch -m master slave
prior to git v2.28
git init # ①
git symbolic-ref HEAD refs/heads/main # ②
① After git init, the branch master does not actually exist. Branches get created only when they have at least one commit.
② This updates .git/HEAD to contain ref: refs/heads/main instead of ref: refs/heads/master. Alternatively, git checkout -b main.
git v2.28+
As #phd said, the -b/--initial-branch option was added in git v2.28. git 2.28 also introduces a config option to specify your preferred default branch:
git config --global init.defaultBranch main
Learn more about the new init.defaultBranch setting in GitHub's blog post.
In case you need to install the latest git version (in Ubuntu)
sudo add-apt-repository -y ppa:git-core/ppa
sudo apt-get update
sudo apt-get install git -y
Ref: https://gist.github.com/YuMS/6d7639480b17523f6f01490f285da509
This is happening due to the unavailability of a tool called Xcode Select, running xcode-select --install in your terminal fixes these issues with Git not working.
I am not new to git but I am newer to github and still a beginner with bash. I was trying to set some config stuff and ending up breaking git on my local machine. Here's what I did following these instructions on github for password caching.
$ git config --global user.name 'myusername'
$ git config --global user.email 'myemail#email.com'
$ git credential-osxkeychain
git: 'credential-osxkeychain' is not a git command. See 'git --help'.
$ curl -s -O http://github-media-downloads.s3.amazonaws.com/osx/git-credential-osxkeychain
$ chmod u+x git-credential-osxkeychain
$ which git
/usr/bin/git
$ sudo mv git-credential-osxkeychain /usr/bin/git
$ git config --global credential.helper osxkeychain
^?^C
After this command git I received no response, just a new line which I eventually ctrl+c'ed out of. Now, whenever I do a git command in any repo, not just this one, the cursor just moves to a new line. I'm unable to push/pull/clone or do use of the commands I normally use.
I've tried reinstalling the latest version of git and still have the problem. What should I do?
Update:
I've tried unsetting credential.helper and uninstalling and reinstalling git. Still seeing the same behavior. I noticed that if I run just $ git the response is Usage: git credential-osxkeychain <get|store|erase>. At this point, I just want to delete credential-osxkeychain. Still unsuccessful.
As requested, the output of which -a git is:
$ which -a git
/usr/bin/git
/usr/local/git/bin/git
When you ran this command:
$ sudo mv git-credential-osxkeychain /usr/bin/git
You overwrote the existing git executable with the git-credential-osxkeychain executable. That script is only meant to be run as a sub-command of Git, not standalone.
If you use Time Machine, you can try to restore the old /usr/bin/git from a backup. Otherwise, you'll need to reinstall Git.
Based on the comments below, it appears that /usr/bin/git is actually still git-credential-osxkeychain, probably because Git installed itself into /usr/local instead of /usr/bin.
If you don't care about the keychain behavior anymore, you can remove the current git executable altogether:
$ sudo rm /usr/bin/git
That may cause Git to start working for you immediately if /usr/local/git/bin is in your path. Or you could simply move it to /usr/local/git/bin/git-credential-osxkeychain:
$ sudo mv /usr/bin/git /usr/local/git/bin/git-credential-osxkeychain
which (again, assuming your path is correct) should allow you to use it as a credential helper like you originally wanted.
I set up github for mac
and now I am trying to use the git command from the terminal.
If I try to run the git rebase command I get the following message
> cd /Applications/GitHub.app/Contents/Resources/git/bin
> git rebase
git: 'rebase' is not a git command. See 'git --help'.
>git --help
usage: git [--version] [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
[-p|--paginate|--no-pager] [--no-replace-objects] [--bare]
[--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
[-c name=value] [--help]
<command> [<args>]
The most commonly used git commands are:
...
rebase Forward-port local commits to the updated upstream head
....
So as you can see from the help output the option rebase is present.
What is wrong in my git?
git --version
git version 1.7.8.2
For me, I found that to fix this error message ("'rebase' is not a git command") I needed to set up Git "exec-path", either via command-line for one-shot use, or better via environment variable:
export GIT_EXEC_PATH=/PATH/TO/git/libexec/git-core
You're using the Git build that comes with GitHub for Mac. They (GitHub, that is) probably modified the binary to remove features that GitHub for Mac doesn't use.
You should really install your 'own' Git. I recommend using Homebrew: Link
This occasionally occurs to me, but only in association with changes in Xcode installation or macOS installs.
The Xcode command line tools need re-installing:
$ xcode-select --install
This is will launch the GUI for installing those tools. Once this finishes, git works as expected.
I tried to update brew:
sudo brew update
But I got this error:
error: Your local changes to the following files would be overwritten by merge:
Listing a lot of files
Error: Failed while executing git pull http://github.com/mxcl/homebrew.git master
Any idea what is going wrong?
There was a bug in Homebrew that was fixed just a few days ago. To fix the bug you can run git reset --hard FETCH_HEAD inside your Homebrew installation. Since that won't fix files that are already seen as modified you can also run git checkout Library to replace your checkout with the latest files. (That wipes all edits so take appropriate measures with any you made.)
The accepted answer is correct but incomplete. If you are getting the error of
error: The following untracked working tree files would be overwritten by merge:
Then go to your terminal and run these commands
cd /usr/local
Then
git reset --hard FETCH_HEAD
Then
git checkout Library
That should get everything in order. Then run
brew update
Let me add: cd /usr/local/git
and then run git reset --hard FETCH_HEAD
go to your terminal and run these commands
cd /usr/local
sudo git reset --hard FETCH_HEAD
sudo git checkout Library
For those of you using OS X El Capitan, your problem may be System Integrity Protection.
If /usr/local exists already, run the following in Terminal:
sudo chown -R $(whoami):admin /usr/local
If /usr/local does not exist:
First, try to create /usr/local the normal way:
sudo mkdir /usr/local && sudo chflags norestricted /usr/local && sudo chown -R $(whoami):admin /usr/local
If you see permission issues instead try:
Reboot into Recovery mode (Hold Cmd+R on boot) & access the Terminal.
In that terminal run: csrutil disable
Reboot back into OS X
Open your Terminal application and execute the line from just above
Reboot back into Recovery Mode & access the Terminal again.
In that terminal execute: csrutil enable
Reboot back into OS X & you'll be able to write to /usr/local & install Homebrew.
Out of no reason (or at least no one I'd understand) the repository in /usr/local (which is the brew install!) lost its remote repository. So, neither a git reset nor a git pull and for sure no brew update would work.
How do you know that happened? Check /usr/local/.git/config whether there are some lines like the following:
[remote "origin"]
url = http://github.com/mxcl/homebrew.git
fetch = +refs/heads/*:refs/remotes/origin/*
If not do as follows:
cd /usr/local
git remote add origin http://github.com/mxcl/homebrew.git
git pull origin master